- Subject: Re: bugs in cd
- From: Eric Blake <ebb9@xxxxxxx>
- Date: Mon, 31 Aug 2009 05:28:16 -0600
- In-reply-to: <loom.20090714T212706-910@xxxxxxxxxxxxxx>
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
According to Eric Blake on 7/14/2009 3:39 PM:
> For the cd command, POSIX 2008 requires that after all pathnames in CDPATH have
> been tested and failed in step 5, then step 6 interprets the directory argument
> relative to PWD. In other words, this demonstrates a bug:
>
> $ dash -c 'cd /tmp; mkdir -p foo; CDPATH=oops; cd foo; echo $?; pwd'
> cd: 1: can't cd to foo
> 2
> /tmp
>
> while bash gets it correct:
>
> $ bash -c 'cd /tmp; mkdir -p foo; CDPATH=oops; cd foo; echo $?; pwd'
> 0
> /tmp/foo
>
> Furthermore, POSIX requires that if the element in CDPATH ends in slash, that
> no additional slashes are added while forming the candidate curpath. In light
> of the fact that //home need not be the same directory as /home (and indeed, on
> cygwin, they are distinct entities), this is also a bug:
>
> $ dash -c 'CDPATH=/; cd home'
> //home
> $ bash -c 'CDPATH=/; cd home'
> /home
Ping.
--
Don't work too hard, make some time for fun as well!
Eric Blake ebb9@xxxxxxx
--
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
[LARTC]
[Bugtraq]
[Yosemite Forum]
[Photo]