dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Eric Blake <eblake@redhat.com>
Cc: dash@vger.kernel.org
Subject: Re: [PATCH] [BUILTIN] cd: support drive letters on Cygwin
Date: Mon, 27 Oct 2014 11:40:10 +0800	[thread overview]
Message-ID: <20141027034010.GA5128@gondor.apana.org.au> (raw)
In-Reply-To: <1413226757-4311-1-git-send-email-eblake@redhat.com>

On Mon, Oct 13, 2014 at 06:59:17PM +0000, Eric Blake wrote:
> The Cygwin platform supports DOS style drive-letter paths such
> as "C:\\dir", even though the preferred form is a POSIX-style
> "/cygdrive/c/dir".  This can be seen by doing things such as
> chdir("c:") (which succeeds) followed by getcwd(NULL, 0) (which
> returns the normalized "/cygdrive/c").  However, dash was trying
> to perform local manipulations on the argument to 'cd' prior to
> calling into libc, in order to update the state of $PWD and
> friends; these manipulations were assuming that the user meant
> to change to a relative subdirectory of the current location,
> as in './c:', instead of honoring the drive letter.  None of
> the other dash builtins take a filename and manipulate it to
> affect shell state (some, like 'test', take a file name, but as
> stat("c:") works just fine, there is no need to normalize).
> 
> This patch has no impact outside of cygwin; on cygwin, it takes
> advantage of a native function call to canonicalize any
> incoming name into preferred form before updating shell state.
> 
> Pre-patch:
> $ dash -c 'cd c: && echo $PWD'
> dash: 1: cd: can't cd to c:
> 
> Post-patch:
> $ dash -c 'cd c: && echo $PWD'
> /cygdrive/c
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>

Patch applied.  Thanks!
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      reply	other threads:[~2014-10-27  3:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 18:59 [PATCH] [BUILTIN] cd: support drive letters on Cygwin Eric Blake
2014-10-27  3:40 ` Herbert Xu [this message]

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=20141027034010.GA5128@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=dash@vger.kernel.org \
    --cc=eblake@redhat.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 NNTP newsgroup(s).