From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16484 invoked by alias); 3 Apr 2012 14:06:49 -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: 16972 Received: (qmail 7080 invoked from network); 3 Apr 2012 14:06:47 -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.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <120403070605.ZM11132@torch.brasslantern.com> Date: Tue, 03 Apr 2012 07:06:05 -0700 In-reply-to: Comments: In reply to Mikael Magnusson "Re: `cd .` in non-existent directory leads into weird corner case" (Apr 3, 12:16pm) References: <120327073414.ZM6783@torch.brasslantern.com> <20120402111219.62cbd0c7@pwslap01u.europe.root.pri> <20120402120008.0ed7e583@pwslap01u.europe.root.pri> <20120403105748.6b16c3aa@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: `cd .` in non-existent directory leads into weird corner case MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 3, 12:16pm, Mikael Magnusson wrote: } } I don't know if this is something that works on all systems, but on } linux at least, it seems that the directory inode sticks around while } a process still has it, or any subdirectory of it, as its current } directory (or otherwise open i suppose). This means that it is still } possible to access the . and .. entries in it, and follow them In order to do this even remotely portably, though, zsh would have to open ".." with readdir() as soon as it cd's into a directory, and then hold open that descriptor until it cd's out again; plus the system would have to support fchdir() -- I don't know how portable that is compared to /proc/*/cwd but I'm pretty sure neither of them is going to be available on every platform where zsh can be compiled.