From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21778 invoked by alias); 2 Apr 2012 10:23:07 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16947 Received: (qmail 18237 invoked from network); 2 Apr 2012 10:23:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.210.44 as permitted sender) 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== MIME-Version: 1.0 In-Reply-To: References: <120327073414.ZM6783@torch.brasslantern.com> Date: Mon, 2 Apr 2012 12:15:59 +0200 Message-ID: Subject: Re: `cd .` in non-existent directory leads into weird corner case From: Mikael Magnusson To: Richard Hartmann Cc: Bart Schaefer , zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 On 2 April 2012 11:52, Richard Hartmann wrote: > On Tue, Mar 27, 2012 at 16:34, Bart Schaefer 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