From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23497 invoked by alias); 2 Feb 2011 22:12:04 -0000 Received: (qmail 23476 invoked by uid 22791); 2 Feb 2011 22:11:55 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Wed, 02 Feb 2011 22:11:48 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 33AFD2CA2D8; Wed, 2 Feb 2011 23:11:40 +0100 (CET) Date: Wed, 02 Feb 2011 22:12:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Cc: Ralf Wildenhues Subject: Re: directories named '...' (dotdotdot) do not work Message-ID: <20110202221139.GS2675@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, Ralf Wildenhues References: <20110202204556.GL2675@calimero.vinschen.de> <4D49C4EB.70204@redhat.com> <20110202212846.GN2675@calimero.vinschen.de> <20110202215346.GQ2675@calimero.vinschen.de> <4D49D434.7050009@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4D49D434.7050009@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-02/txt/msg00082.txt.bz2 On Feb 2 15:01, Eric Blake wrote: > [re-adding Ralf, in case he's not subscribed] > > On 02/02/2011 02:53 PM, Corinna Vinschen wrote: > >> No, I'm using tcsh. Apparently you're right, it doesn't work in > >> XP, but it works in W7. Looks like Microsoft reworked the CreateProcess > >> call at some point. I have an idea how this might be possible to > >> workaround. Stay tuned. > > > > Yes, my workaround works. What happens is that XP's CreateProcess calls > > an internal function at one point which drops leading spaces and > > trailing dots and spaces from the path, since these were always invalid > > in DOS paths. And a path component which consists entirely of dots > > and/or spaces is just invisible from a DOS path perspective. > > > > However, if the path to the executable is prepended by the long-path > > prefix "\\?\", then the CreateProcess function understands the path > > even on XP since the prefix suppresses the DOS path strangling. > > > > However, that's not a generic solution. At one point we deliberately > > dropped the preceeding "\\?\" because this breaks some native Win32 > > child processes which are not long-path aware. So, right now, we only > > keep the long-path prefix if the path is actually longer than MAX_PATH. > > > > To fix that, we would have to scan the entire path for path components > > which contain leading spaces or trailing dots or spaces. That makes > > fork even slower than it already is. > > Well, that would only be if the path is shorter than MAX_PATH (256) > bytes, so it's not like we have a quadratic scaling problem over > thousands of bytes. Furthermore, using a directory literally named > '...' already causes problems for windows programs that ar not long-path > aware, so the workaround is no worse than what they currently get from > such a path. But you're right, that taking the time to scan for any > occurrence of: > > '.\', './', '/.', ' \', ' /' > > and checking for five patterns across 256 bytes definitely adds time. > > > Given that it works fine on Vista and Windows 7 anyway, is it really > > worth to add this extra code just to support an old OS in a very rare > > situation? > > Can't we make the scan conditional on the windows version? That is, > spend the extra time to keep XP happy, but skip the scan on newer Windows? I'm not opposed to a pre-Vista workaround. The code should be added to the "if (runpath)" code starting at line 494 in spawn.cc. If you have an idea how to do this test as fast as possible, please send a patch. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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