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 16947
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Richard Hartmann <richih.mailinglist@xxxxxxxxx>
- Subject: Re: `cd .` in non-existent directory leads into weird corner case
- Date: Mon, 2 Apr 2012 12:15:59 +0200
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, 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=ValDzSH9Ew9Rive1/6W4bMpQyWauRdwjdzkaj4pEl+s=; b=RyIHj+Uh6EDJUPoRIjc5kUqjHY13gxurrxT1GcgY0AtPaEQ+dYRkeKniKhhj21FPWm h03uTGXBhrBCL7BnIKz0MaaZOjJsoJ8ffgrr7jE0WXj2PHZ6XDsXRM41BiyiB8O8DbXX FPEgsG2iIFiKmYmVY6c3Xgliqi8NBxDphmmV7QHNwfIPmbL7SKSV31bfhjOmG5CtfYoB rPphkPstRLelZ7zY/Le6Zcja33+/lZkZfQd3FL4j2AFkIXGSbxeCPcHXDodIQ4051TvB SZ/8mahGuPGNTcL2fbRKUZVGX26Pi+1SbHEafMRGf5itTihPXujzP+nl+6W9SLw37JPe 3pXA==
- In-reply-to: <CAD77+gSn9zrTHDMj=zi_Y5M6b86pOizkUin8zVVEAU1aTfuKfw@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> <120327073414.ZM6783@torch.brasslantern.com> <CAD77+gSn9zrTHDMj=zi_Y5M6b86pOizkUin8zVVEAU1aTfuKfw@mail.gmail.com>
On 2 April 2012 11:52, Richard Hartmann <richih.mailinglist@xxxxxxxxx> wrote:
> On Tue, Mar 27, 2012 at 16:34, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
>> However, I've always been a little puzzled about the decision to set
>> $PWD to "." in this case. Bash remembers the relative location:
>
> 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.
Weird, when I try making a directory and remove it, I can still cd ..
to the parent... I can even cd into the dir with another shell (via
/proc/$$/cwd), and cd .. to the correct parent dir from that other
shell.
> 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 succeed silently because the directory exists and is empty.
% ls
% pwd
.
% stat .
File: '.'
Size: 6 Blocks: 0 IO Block: 4096 directory
Device: 811h/2065d Inode: 299438815 Links: 0
Access: (0755/drwxr-xr-x) Uid: ( 1000/ mikachu) Gid: ( 100/ users)
Access: 2012-04-02 12:12:26.696856559 +0200
Modify: 2012-04-02 12:12:26.696856559 +0200
Change: 2012-04-02 12:12:31.260107270 +0200
When I try bart's double-directory trick, I can still cd .. twice and
get back to the correct grandparent directory.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author