delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/03/06/09:03:43

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Authority-Analysis: v=1.0 c=1 a=xe8BsctaAAAA:8 a=OywUXPj7vYnWA9m4SdQA:9 a=ISqrm64bDaW6uGEUkzgA:7 a=YhpCbbshSaNQwpCDQdz6wdZdF1cA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10
Message-ID: <47CFF979.6080201@byu.net>
Date: Thu, 06 Mar 2008 07:02:33 -0700
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: bug with touch t/
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> <20080306132748 DOT GP18407 AT calimero DOT vinschen DOT de> <47CFF263 DOT 90804 AT byu DOT net> <20080306134546 DOT GQ18407 AT calimero DOT vinschen DOT de>
In-Reply-To: <20080306134546.GQ18407@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Corinna Vinschen on 3/6/2008 6:45 AM:
| SUSv3(*) says:
|
|   [EISDIR]
|     The named file is a directory and oflag includes O_WRONLY or O_RDWR.
|   [ENOENT]
|     O_CREAT is not set and the named file does not exist; or O_CREAT is
|     set and either the path prefix does not exist or the path argument
|     points to an empty string.
|
| Given these descriptions, I can't see anything wrong with that Linux
| behaviour.

By those SUSv3 rules (which are identical to POSIX), open("t/",
O_RDONLY|O_CREAT) when t does not exist falls under ENOENT, not EISDIR.
In POSIX 2004, path resolution requires that if a trailing slash is
present, resolution is performed as if by "t/.", making "t" a path prefix
which is not present.  And in the draft POSIX 200x, the wording has been
made more explicit that when doing path resolution, if there is a trailing
slash but the text before the slash does not name an existing directory,
then it fails with ENOENT.

But on Linux:
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)

Linux is returning the wrong errno for open, according to SUSv3/POSIX.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHz/l584KuGfSFAYARAuyMAJ99nmo2dcOG9EmMpKhR7gPJkelsbgCguHZE
YfHGhOThDIucOBwO2H9kkrA=
=5I6D
-----END PGP SIGNATURE-----

--
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