Zsh Mailing List Archive
Messages sorted by:
Re: `cd .` in non-existent directory leads into weird corner case
- X-seq: zsh-users 16926
- From: Richard Hartmann <richih.mailinglist@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: `cd .` in non-existent directory leads into weird corner case
- Date: Tue, 27 Mar 2012 17:25:38 +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:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=QFR24KqOLbNig7WcEOJmJpqajZ4E5rIJcPRR9u1KkxI=; b=Y/Q92PB5XXEscN6to56d8N3qLmUA37PTTMEq7uF1Ai8WEGsCp4sP3F05NW6JNKa2Ha LtscU/DmJAVEAqDNZhoNNlnaqhMq3KtjkWG/CJ3Vco46zGQjrp0huVa1/MyhlrqCXV+u g3KWksRNJBnfIgyLx0j74D/r8QZwwFBrR8UJKXUdpsd5rCdVo0OcmKg6XySnoGSUCULy yC6Ka0SFb5dFpSU1iAaD6SxwD6eV9UDYqX4+4+QR0k9sKiyt7gECOlS/rTFgEXSxJo9n LgWa6NYFf3buLx0Y21vGRt42VMvfVaTRKEh05MKse1zs25GiKx/KkcpyvYm1FlU+Zx6y e0Tw==
- In-reply-to: <120327073414.ZM6783@torch.brasslantern.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAD77+gT4LXRyTL8V1UZrNfCohyJ9peTNdfZ=G7Q-sJcDnyNE8Q@mail.gmail.com> <120327073414.ZM6783@torch.brasslantern.com>
On Tue, Mar 27, 2012 at 16:34, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> I believe the thinking was that the harm has already been done once the
> current directory has been removed out from under the shell.
Yes-ish; zsh is arguably making it worse by locking itself into a
relative path prison.
> Possibly; I seem to recall a (very long ago) discussion in which it was
> concluded that the situation arose so rarely as to not be of concern.
> How often does one "cd ." ?
With git branches, the deletion of directories you were just in is
relatively common, sometimes git will delete the underlying directory
and create a new one with the same name, instead. This confuses
vcs_info. `cd .` is my default way of making vcs_info read in its info
> Various external commands such as "ls" silently exit with success on a
> non-existent current working directory, I think that may have been the
> model for the original behavior.
They fail silently, they don't lock themselves in.
> However, I've always been a little puzzled about the decision to set
> $PWD to "." in this case. Bash remembers the relative location:
And that's pretty much the beef. Would it be acceptable to change this
behavior if `cd .` does not start throwing errors?
> Of course zsh already does magic in that case:
Interesting; while maybe handy, I think I would prefer it to fail
instead of DWIM.
Messages sorted by: