Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `cd .` in non-existent directory leads into weird corner case
- X-seq: zsh-users 16922
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Richard Hartmann <richih.mailinglist@xxxxxxxxx>
- Subject: Re: `cd .` in non-existent directory leads into weird corner case
- Date: Tue, 27 Mar 2012 07:13:43 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=mesmtp; bh= qCzyBPHUh1agS2fAJeBhFxwFPGI=; b=AW69pfqSBNR9Zry5Gn7tl0dwKmtZnreT nsnpJ34Nf2CoILeQMQ5tTYQYn1V+sEW42797rmq51k1+9Nkn8VEZNeW6ZML2PR3F 4FD1+UTqz5vwGEVNO+XZ6V8zCZVdc/OkBYlzr4oIDHV8CY7anAhE2tg3YCAbc428 jcA/LzlA8MA=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=smtpout; bh=qCzyBPHUh1agS2fAJeBhFxwFPGI=; b=DMYPXoik/eVruMUWffEvGFbqX5lR dmVGgsm++1r94clZYeB+jrmzQSP/as8Q8UQnkHjVd0ozF+tWnJnxqPJ5ycLdK5F4 A7wpY5EGDJ4phbBquFwxy+7F6h3n+0HHfqo7T+Na6REWoVqiTG1lYBg2aTKqdVZv kUxp+5jCjY10iak=
- In-reply-to: <CAD77+gT4LXRyTL8V1UZrNfCohyJ9peTNdfZ=G7Q-sJcDnyNE8Q@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAD77+gT4LXRyTL8V1UZrNfCohyJ9peTNdfZ=G7Q-sJcDnyNE8Q@mail.gmail.com>
Richard Hartmann wrote on Tue, Mar 27, 2012 at 02:56:23 +0200:
> Hi all,
>
> maybe I am misunderstanding zsh's intentions here, but this behaviour
> seems to be quite useless/counter-intuitive and potentially harmful:
>
> richih@adamantium ~ % zsh -f
> adamantium% PS1="%~ %# "
> ~ % mkdir testdir
> ~ % cd testdir
> ~/testdir % rmdir ~/testdir
> ~/testdir % cd .
> . % ls
> . % pwd
> .
> . % cd ..
> . % pwd
> .
> . %
>
> Wouldn't it be better if zsh threw an error as soon as the user tries to `cd .`?
>
FWIW:
stat64(".", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
chdir("/tmp/d") = -1 ENOENT (No such file or directory)
stat64(".", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
chdir(".") = 0
stat64("/tmp/d", 0xbf9b00ec) = -1 ENOENT (No such file or directory)
stat64(".", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
rt_sigprocmask(SIG_BLOCK, [INT], [CHLD], 8) = 0
stat64("..", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
open("..", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
which tells me two things: that there is an initial chdir() call which
fails (re your suggestion to propagate that), and that the behaviour
might be even weirder if you remove the parent directory as well.
('cd /tmp/d/e && rm -rf /tmp/d')
>
> Thanks,
> Richard
Messages sorted by:
Reverse Date,
Date,
Thread,
Author