Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: a bug of zsh
On Wed, 28 Sep 2016 22:06:25 +0800
ZiHan Zheng <zhengzihan1996@xxxxxxxxx> wrote:
> to reproduce this bug:
>
> cd ~
> mkdir aaa
> cd aaa
> rm ~/aaa -r
> cd .
>
> then current working directory is just "." and you can do nothing until cd
> into an absolute path.
Hmmm... I can see you're point, I think --- before you do "cd .", the
shell will happily use the logical directory structure to e.g. "cd ..",
whereas after you do "cd ." you're stuck without something like cd
$PWD/..
It would certainly be good if there's some way of aborting the "cd ."
consistently so we both don't actually change directory and don't lose
state. I think the problem may be once we find we can't cd any more we
throw up our hands in horror and decide we don't know where we are,
which is certainly a bit feeble, particularly since there's no
outward indication of a problem until you find you're trapped.
Is there some reason we can't just stat the directory first and bail
out early? I know it's prohibitively expensive testing glob results
with stat, but this is a rather different case.
However, the cd logic is already more complicated than you would
probably believe, and changing to a directory that no longer exists
isn't going to have good effects, so I'm not sure how much sleep we're
(well, I'm) actually going to lose over this, to be brutally honest.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author