Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cd bugs
- X-seq: zsh-workers 27150
- From: Eric Blake <ebb9@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: cd bugs
- Date: Tue, 14 Jul 2009 22:30:33 +0000 (UTC)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <loom.20090714T205419-391@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Eric Blake <ebb9 <at> byu.net> writes:
>
> POSIX requires cd to give output if a nonempty entry in CDPATH played a role,
> or if 'cd -' was used. Therefore, this line demonstrates two zsh bugs:
>
> $ zsh -c 'emulate -R sh; cd /tmp; mkdir -p d; CDPATH=.; cd d; cd -; rmdir d'
> $ bash -c 'cd /tmp; mkdir -p d; CDPATH=.; cd d; cd -; rmdir d'
> /tmp/d
> /tmp
> $
>
> while bash was correct in printing the absolute name of d and its parent.
Another bug - POSIX requires that CDPATH be searched prior to ., regardless of
whether CDPATH contains an explicit . or an empty entry. Therefore, this is
another example where bash is right. But I think the zsh native behavior of
favoring . over CDPATH if CDPATH does not include . is a little more intuitive,
so this may warrant the addition of a new shell option (POSIX_CD?) that defaults
to off in zsh mode but defaults to on in sh mode for POSIX compliance.
$ zsh -c 'emulate -R sh; cd /tmp; mkdir -p a/b b; CDPATH=a; cd b; /bin/pwd'
/tmp/b
$ bash -c 'cd /tmp; mkdir -p a/b b; CDPATH=a; cd b; /bin/pwd'
/tmp/a/b
/tmp/a/b
$ cd /tmp; rm -Rf a b
$
--
Eric Blake
Messages sorted by:
Reverse Date,
Date,
Thread,
Author