From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10767 invoked by alias); 7 Feb 2013 16:26:15 -0000 Received: (qmail 10720 invoked by uid 22791); 7 Feb 2013 16:26:12 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mho-04-ewr.mailhop.org (HELO mho-02-ewr.mailhop.org) (204.13.248.74) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Feb 2013 16:26:03 +0000 Received: from pool-173-76-49-193.bstnma.fios.verizon.net ([173.76.49.193] helo=cgf.cx) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1U3UIU-000EkA-JO for cygwin@cygwin.com; Thu, 07 Feb 2013 16:26:02 +0000 Received: from localhost (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id C958088038F for ; Thu, 7 Feb 2013 11:26:01 -0500 (EST) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18UV+5sT/1vzj+CLExPP2H3 Date: Thu, 07 Feb 2013 16:26:00 -0000 From: Christopher Faylor To: cygwin@cygwin.com Subject: Re: stat() and tilde prefix (was bad bash tab completion) Message-ID: <20130207162601.GA1079@ednor.casa.cgf.cx> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <50F395D5.4050201@shaddybaddah.name> <20130114061747.GB16739@ednor.casa.cgf.cx> <20130114100002.GA22039@calimero.vinschen.de> <50F417F9.8040108@shaddybaddah.name> <20130114161307.GB8617@calimero.vinschen.de> <50F54C93.9090702@shaddybaddah.name> <511350F3.8040702@shaddybaddah.name> <5113C886.9070904@redhat.com> <5113D1ED.20305@towo.net> <20130207162322.GB15210@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130207162322.GB15210@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2013-02/txt/msg00075.txt.bz2 On Thu, Feb 07, 2013 at 05:23:22PM +0100, Corinna Vinschen wrote: >On Feb 7 17:10, Thomas Wolff wrote: >> Am 07.02.2013 16:30, schrieb Eric Blake: >> >... >> > >> >... >> >the fact that cygwin's handling of .. is not POSIX-compliant. I think a >> >better fix would be to change file_exists() itself instead of adding a >> >misnamed wrapper function; then bashline.c wouldn't even need patching. >> > The string 'tilde' need not even be in the patch; what you are really >> >after is a function that says that if '..' is found within a string >> >being probed for existence, then add an additional check to see if the >> >prefix of that string exists as a directory. >> > >> >But I don't mind experimenting with the idea - it remains to be seen >> >whether people will complain that bash is noticeably slower because it >> >takes time to double-check instead of rely on cygwin's non-POSIX >> >shortcut. And the slowdown would only be on paths containing a '..'; I >> >would NOT be checking for symlinks (even though symlinks containing .. >> >are also being interpreted in a non-POSIX manner, it is much more >> >expensive to second-guess if you have to check every name for being a >> >symlink than it is to just check for literal ..). >> Do I interpret correctly that you talk about bash filename completion here? >> Referring to http://cygwin.com/ml/cygwin/2013-01/msg00201.html, >> I'd like to point out that while this ".." thing is a cygwin bug, or >> known downside as Corinna says, >> the same issue occurs on Linux precisely with filename completion >> which isn't consistent there either. >> So it would be "over-fixing" to handle that specifically in bash. >> >> On the other hand, considering again this "downside": >> If the core cygwin filesystem function would follow this approach, >> simply checking for an occurrence of ".." first before resolving the >> filename, >> wouldn't that be an acceptable fix without inappropriate penalty? > >You don't know what you're asking for (can of worms, etc.) > >This is some kind of chicken egg problem. > >- The path must be normalized, otherwise we can't reliably convert > the POSIX path prefix to a Windows pathname. > >- Only after converting to a Windows path, we can perform file checks. > >- Rinse and repeat. > >Also, the path normalization is performed in an entirely distinct >function from the mount point conversion, and this in turn is another >function than the path function handling symlinks and devices. >Changing that requires to implement the path conversion functionality >almost from scratch. Given the age of some of these functions, I'd >like to have done that for a long time, but I'm constantly shying away >since I don't want to break what is working today. There's, of course, >still the aforementioned chicken-egg problem. What she said. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple