delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/03/06/08:28:59

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 6 Mar 2008 14:27:48 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: bug with touch t/
Message-ID: <20080306132748.GP18407@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20080304T214047-23 AT post DOT gmane DOT org> <20080305183640 DOT GI18407 AT calimero DOT vinschen DOT de> <47CFEE38 DOT 5040905 AT byu DOT net>
MIME-Version: 1.0
In-Reply-To: <47CFEE38.5040905@byu.net>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar  6 06:14, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Corinna Vinschen on 3/5/2008 11:36 AM:
> |> $ : > t/
> |> t/: Is a directory.
> |>
> |
> | Should be fixed in the new 1.5.25-11 test release.
>
> Yes, in 1.5.25-11, it is _correctly_ failing with ENOENT.  But in CVS, it
> looks like you changed it to return EISDIR instead?
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/winsup/cygwin/fhandler.cc.diff?cvsroot=src&r1=1.313&r2=1.314
>
> POSIX requires ENOENT, not EISDIR (if neither 't' nor 't/' exist, and you
> are performing file name resolution for open("t/",O_RDONLY|O_CREAT), then
> the resolution should be performed as if it were
> open("t/.",O_RDONLY|O_CREAT) and fail with ENOENT since t is not a
> directory).  EISDIR is reserved for cases like open("t/",O_WRONLY) when
> "t/" already exists.

I examined this situation on Linux.  In Linux, touch tries to open t\
and open() returns EISDIR.  The fact that you see an ENOENT is a result
of touch trying to use other methods to set the time:

  Linux$ strace touch t/
  [...]
  open("t/", O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY, 0666) = -1 EISDIR (Is a directory)
  futimesat(AT_FDCWD, "t/", NULL)         = -1 ENOENT (No such file or directory)

When you look into the strace on Cygwin, you'll see a similar behaviour
now.  open returns with errno set to EISDIR, then touch tries to set the
time neverthelss using a call to utimes().  Thus you get "No such file
or directory" from utimes.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019