Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sat, 27 Aug 2005 10:44:58 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Problem with sh/bash and snapshot cygwin1-20050825.dll Message-ID: <20050827084458.GM17452@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <430E9B0B DOT 8040303 AT scytek DOT de> <20050826052618 DOT GC4087 AT trixie DOT casa DOT cgf DOT cx> <20050826090717 DOT GB21203 AT calimero DOT vinschen DOT de> <430F0849 DOT 8040002 AT byu DOT net> <20050826123244 DOT GA23422 AT calimero DOT vinschen DOT de> <430F7BD7 DOT 5000406 AT byu DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <430F7BD7.5000406@byu.net> User-Agent: Mutt/1.4.2i On Aug 26 14:30, Eric Blake wrote: > $ readlink u > x > $ ls x* > x.exe > $ ls -lF x > - -rwxr-xr-x 1 eblake None 13961 Mar 10 06:54 x* > $ file x # See below for more on this... > x: writable, executable, regular file, no read permission > $ ./myreadlink u/blah > 'u/blah': NULL, 2 No such file or directory > > You are right that the code is correctly giving ENOTDIR when the symlink > isn't half-dangling (ie stat() succeeds but open() fails): > $ readlink u.exe > x.exe > $ ./myreadlink u/blah > 'u/blah': NULL, 20 Not a directory That's a result of attaching .exe to symlinks. When iterating over paths, the .exe suffix is only checked on the last component, never on inner (== directory) components. This makes sense, otherwise every component has to tested twice as often, which would slow down Cygwin a lot. I don't see a good reason to change that, just for the (questionable) success, to exchange one errno for another. After all, EINVAL is correct, as would be ENOTDIR. I don't see that POSIX demands an order of errnos in the case where two or more different errnos are correct. For instance, consider a function which treats the first parameter as invalid if it's NULL, and which copies something into the space where the second parameter points to: int err = foo (NULL, (void *) 0x01); Which errno is correct to return, EINVAL or EFAULT? Btw., what was the exact reason to attach the .exe suffix to symlinks pointing to executables? I fail to see the advantage, right now. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- 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/