Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 3.1.6-test-1: strange cd behaviour
- X-seq: zsh-workers 7122
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: 3.1.6-test-1: strange cd behaviour
- Date: Wed, 14 Jul 1999 08:56:07 +0200 (MET DST)
- In-reply-to: "Andrej Borsenkow"'s message of Tue, 13 Jul 1999 19:29:02 +0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Andrej Borsenkow wrote:
> (/tools/src is in cdpath)
>
> bor@itsrm2:/tools/src/zsh-3.1.6-test-1%> builtin cd zsh-3.1.6-test-1/..
> bor@itsrm2:/tools/src/zsh-3.1.6-test-1%> echo $?
> 0
> bor@itsrm2:/tools/src/zsh-3.1.6-test-1%> /bin/pwd
> /tools/src/zsh-3.1.6-test-1
>
> That is, cd does not change directory and returns success. I have some scripts
> that do "cd /some/dir && rm -r ..." ahem ...
That's a bit tricky... you have either no `.' in your `cdpath', or it is
before /tools/src, right?
The problem is that cd_do_chdir() calls cd_try_chdir() with all
elements from `cdpath' -- if cdpath contains no `.', it first calls
cd_try_chdir() for the current directory (always plus the argument
given to `cd'). Well, cd_try_chdir() builds the full path (directory
from `cdpath' or current directory and the argument) and then calls
fixdir() -- which reduces /foo/bar/baz/.. to /foo/bar. So if `.' is
tested first and you try to `cd' to `dir/..', `cd' will always decide to
go to the current directory -- i.e. do nothing.
So the workaround for now is to put a `.' at the end of `cdpath'.
Hm, should we just document this or change it -- and how?
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author