From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2743 invoked by alias); 28 Mar 2013 15:08:15 -0000 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 Received: (qmail 2704 invoked by uid 89); 28 Mar 2013 15:08:08 -0000 X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD,SPF_SOFTFAIL autolearn=ham version=3.3.1 Received: from mail.sidefx.com (HELO mail.sidefx.com) (38.99.137.163) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 15:08:05 +0000 Message-ID: <51545CD9.4050607@sidefx.com> Date: Thu, 28 Mar 2013 15:08:00 -0000 From: Edward Lam User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: [PATCH] Support DOS paths in dash References: <4B5860C9.50100@sidefx.com> <4B591221.10501@byu.net> <4B91105B.7050205@sidefx.com> <20100305152637.GK7980@calimero.vinschen.de> <4B913788.40301@sidefx.com> <4B913AF2.3070102@redhat.com> <20100305172048.GN7980@calimero.vinschen.de> <4EDA9E99.9030307@redhat.com> In-Reply-To: <4EDA9E99.9030307@redhat.com> Content-Type: multipart/mixed; boundary="------------030500020100010905080506" X-Virus-Found: No X-SW-Source: 2013-03/txt/msg00396.txt.bz2 --------------030500020100010905080506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1310 Hi Folks, I finally got down to looking at how to fix this in dash and came up with the attached patch (against dash-0.5.7). It's simple enough and so cd now works. Please consider this for Cygwin. Thanks! -Edward On 03/12/2011 5:11 PM, Eric Blake wrote: > On 03/05/2010 10:20 AM, Corinna Vinschen wrote: > > Rounding out a (super-old) thread on my dash todo list... > >>>> $ dash >>>> $ cd /c >>>> $ ls -d W* >>>> WINDOWS >>>> $ cd c:/WINDOWS >>>> cd: 3: can't cd to c:/WINDOWS >>> >>> Let's rule out bash vs. dash complexities, and first focus on whether >>> cygwin1.dll might be at fault. > >> >> Works fine in Cygwin, I just tested it: > ... >> $ gcc -g -o chdir chdir.c >> $ ./chdir C:/Windows >> pwd: /cygdrive/c/Windows >> >> It's a problem in dash apparently. > > I finally spent time in gdb figuring out what's going on. > > The problem is that dash tries to convert c:/windows to an absolute > path, since it doesn't start with /. I suppose I could teach dash to > recognize [letter]:/ as absolute paths, although that makes dash larger, > and puts a burden on me (since I can guarantee upstream dash won't > accept such a patch). > >> I just don't care enough for DOS paths so I won't fix. > > Me neither. And since you can use /cygdrive/c, not c:/, I won't bother > to fix it. > --------------030500020100010905080506 Content-Type: text/plain; charset=windows-1252; name="dash-0.5.7-cd.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dash-0.5.7-cd.patch" Content-length: 543 --- src/cd.c 2011-03-15 03:18:06.000000000 -0400 +++ src/cd.new.c 2013-03-28 11:03:32.649576500 -0400 @@ -38,6 +38,9 @@ #include #include #include +#ifdef __CYGWIN__ +#include +#endif /* * The cd and pwd commands. @@ -194,6 +197,11 @@ char *cdcomppath; const char *lim; +#ifdef __CYGWIN__ + char pathbuf[PATH_MAX + 1]; + cygwin_conv_to_full_posix_path (dir, pathbuf); + dir = pathbuf; +#endif cdcomppath = sstrdup(dir); STARTSTACKSTR(new); if (*dir != '/') { --------------030500020100010905080506 Content-Type: text/plain; charset=us-ascii Content-length: 218 -- 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 --------------030500020100010905080506--