From: Edward Lam <edward@sidefx.com>
To: cygwin@cygwin.com
Subject: [PATCH] Support DOS paths in dash
Date: Thu, 28 Mar 2013 15:08:00 -0000 [thread overview]
Message-ID: <51545CD9.4050607@sidefx.com> (raw)
In-Reply-To: <4EDA9E99.9030307@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
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.
>
[-- Attachment #2: dash-0.5.7-cd.patch --]
[-- Type: text/plain, Size: 543 bytes --]
--- 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 != '/') {
[-- Attachment #3: Type: text/plain, Size: 218 bytes --]
--
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
next prev parent reply other threads:[~2013-03-28 15:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 15:36 [ANNOUNCEMENT] [1.7] Updated: dash-0.5.5.1-2; Obsolete: ash Eric Blake
2009-07-14 15:36 ` GOLD STAR! (was Re: [ANNOUNCEMENT] [1.7] Updated: dash-0.5.5.1-2; Obsolete: ash) Corinna Vinschen
2010-01-21 15:01 ` [ANNOUNCEMENT] [1.7] Updated: dash-0.5.5.1-2; Obsolete: ash Edward Lam
2010-01-21 16:03 ` Christopher Faylor
2010-01-22 4:15 ` Eric Blake
2010-03-05 14:11 ` Edward Lam
2010-03-05 15:33 ` Corinna Vinschen
2010-03-05 17:00 ` Edward Lam
2010-03-05 17:01 ` Edward Lam
2010-03-05 17:06 ` Edward Lam
2010-03-05 17:20 ` Eric Blake
2010-03-05 17:40 ` Corinna Vinschen
2010-03-05 20:11 ` Edward Lam
2011-12-03 22:11 ` Eric Blake
2013-03-28 15:08 ` Edward Lam [this message]
2010-03-05 17:10 ` Edward Lam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51545CD9.4050607@sidefx.com \
--to=edward@sidefx.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).