Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Inconsistent behaviour of cd and AUTO_CD



Vincent Lefevre wrote:

> With zsh 4.0.4 and AUTO_CD, under Linux and ext3 filesystem type:
> 
> ay:~> mkdir blah
> ay:~> cd blah
> ay:~/blah> ..
> ay:~> cd blah
> ay:~/blah> rmdir ../blah
> ay:~/blah> ..
> zsh: permission denied: ..
> zsh: exit 1     ..
> ay:~/blah[Failed 1]> cd ..
> ay:~>

Yes, clearly this is inconsistent. If you set either of the chase_links
or chase_dots options, the .. implicit cd will work like the explicit
one. Note that I don't think the filesystem type, operating system or
zsh version makes any difference to this (except IRIX doesn't let me
remove the directory). In fact, even tcsh has this exact same
inconsistency.

The problem is in the cancd2() function in exec.c. It only tries an
implicit cd after establishing that the target is an accessible
directory. With chase_dots, it first resolves the target to $PWD:h so
it works. And for the cd command it doesn't have to decide what it is
doing so it just does the cd.

So cancd2() somehow needs to do a better job of resolving what the
target directory is before determining if it is accessible. I don't
fully understand the semantics of no_chase_dots to know how it should
do this. Any ideas?

Oliver

-- 

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.



Messages sorted by: Reverse Date, Date, Thread, Author