delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/03/28/11:09:00

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=BXxMN/
L0e2t8ywwr90wq7dyfcuISSoZRHEKIUBl/JzpQ3EWPGcdirzRBB69zaDhWiM3Khx
9v/j+41HCr9i+mCPoJifhBVtCop8xAb45/vN+zggV/x7t5IaOJ2xF1KPPmuUwhtR
okB7zLFMLf2gErSgsi0dguWJg/Axe05vwzjlQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=GB7os6dHh8Fn
cv0STXpzFo0mVoo=; b=aIFCF4GD5bja1+35kSmp+SPhrNst2X3rRwmLsxlUUlvK
YgdeQBMtGAqiHplyumndSk7iORyZ8ODO8PXT5jOSxFybjMo5dVg5hctC6V5zHesd
CqqaDNkUy3CvFEIpE0Eq7Q+0nG2P7vDLPHXqZ9N3xM6JewAS+aRhU4/yaQG5DOc=
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
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
Message-ID: <51545CD9.4050607@sidefx.com>
Date: Thu, 28 Mar 2013 11:08:09 -0400
From: Edward Lam <edward AT sidefx DOT com>
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 AT cygwin DOT com
Subject: [PATCH] Support DOS paths in dash
References: <announce DOT 4A5C7A2B DOT 4020700 AT byu DOT net> <4B5860C9 DOT 50100 AT sidefx DOT com> <4B591221 DOT 10501 AT byu DOT net> <4B91105B DOT 7050205 AT sidefx DOT com> <20100305152637 DOT GK7980 AT calimero DOT vinschen DOT de> <4B913788 DOT 40301 AT sidefx DOT com> <4B913AF2 DOT 3070102 AT redhat DOT com> <20100305172048 DOT GN7980 AT calimero DOT vinschen DOT de> <4EDA9E99 DOT 9030307 AT redhat DOT com>
In-Reply-To: <4EDA9E99.9030307@redhat.com>
X-Virus-Found: No

--------------030500020100010905080506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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"

--- 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 <string.h>
 #include <unistd.h>
 #include <limits.h>
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#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

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019