Re: [PATCH] [BUILTIN] cd: support drive letters on Cygwin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Patch applied.  Thanks!
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux