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 16954
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- Subject: Re: `cd .` in non-existent directory leads into weird corner case
- Date: Mon, 2 Apr 2012 13:10:17 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/jtpVt8uuPCiNwpy/DKwz2FYCOyrPRp6JnofKC9tdXQ=; b=VI+NmVDWOw3pYBY42/Zan0Y9cFcs5KKFJ2VJcJ8AcNB/U5CzFHWoDXTENxLSfLg+KK tFrdL2ZTxZSz50FWa7ZuDKQG6W8HSb+ZlqgIXZSU0xa6TvpQ88cKb3w7HtGWc0bp2h0z zmszMP+GVcsX/gkduYds7jYZXWPwzW7M/wixc3U1mRqVS0XrhCqQMXT5acil6Wce32J3 2EgclKbXajtaWOA5va1+jju7tPWLp9veQ+65qEK+VT12FobC51aX4kl2CArVkgz2A5Ef UHcr+lZS2CBpSk7V6IqgJYa/kVigu8GIr+eRyl4+cEgiTMZ57Ns2yY69XSafhUDy5MsM D56w==
- In-reply-to: <20120402120008.0ed7e583@pwslap01u.europe.root.pri>
- 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> <120327073414.ZM6783@torch.brasslantern.com> <CAD77+gSn9zrTHDMj=zi_Y5M6b86pOizkUin8zVVEAU1aTfuKfw@mail.gmail.com> <20120402111219.62cbd0c7@pwslap01u.europe.root.pri> <CAHYJk3QPQC-P8wbpMJDkxvdww-Lar3L+AoaHzM8rh_rO=Z=zYA@mail.gmail.com> <20120402120008.0ed7e583@pwslap01u.europe.root.pri>
On 2 April 2012 13:00, Peter Stephenson <Peter.Stephenson@xxxxxxx> wrote:
> On Mon, 2 Apr 2012 12:56:55 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> >> Just to make sure this does not get lost, do we agree that not
>> >> changing $PWD to a literal dot would make sense? Escalating the ENOENT
>> >> to the user is probably the best approach.
>> >
>> > Sounds OK. Silently failing and changing the directory reported doesn't
>> > really do a lot of good to anyone.
>>
>> Can we keep the current behaviour for cd -P?
>
> I think that only those cases that currently give up and silently revert
> to "." as the current directory would be affected, so anything that
> already did something sensible would still do that. Certainly that's
> what we should be aiming for.
One (semi-)realistic case I came up with, one shell sits in a
directory, someone else first moves the directory, then deletes it,
then the shell tries to 'cd ..'. In this case I would like it to end
up in the new parent directory as it does now [1], not the old
"$PWD:h". (with chasedots/-P) (and even if I did 'cd .' first for some
weird reason).
--
Mikael Magnusson
[1]
{13:08:58|~}% mkcd foo
{13:09:04|~/foo}% mv ~/foo ~/tmp # ~/tmp already exists
{13:09:07|~/foo}% rmdir ~/tmp/foo
{13:09:09|~/foo}% cd ..
{13:09:09|~/tmp}%
Messages sorted by:
Reverse Date,
Date,
Thread,
Author