From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2700 invoked by alias); 27 Mar 2012 05:22:52 -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: 16922 Received: (qmail 7911 invoked from network); 27 Mar 2012 05:22:40 -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=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=mesmtp; bh= qCzyBPHUh1agS2fAJeBhFxwFPGI=; b=AW69pfqSBNR9Zry5Gn7tl0dwKmtZnreT nsnpJ34Nf2CoILeQMQ5tTYQYn1V+sEW42797rmq51k1+9Nkn8VEZNeW6ZML2PR3F 4FD1+UTqz5vwGEVNO+XZ6V8zCZVdc/OkBYlzr4oIDHV8CY7anAhE2tg3YCAbc428 jcA/LzlA8MA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=smtpout; bh=qCzyBPHUh1agS2fAJeBhFxwFPGI=; b=DMYPXoik/eVruMUWffEvGFbqX5lR dmVGgsm++1r94clZYeB+jrmzQSP/as8Q8UQnkHjVd0ozF+tWnJnxqPJ5ycLdK5F4 A7wpY5EGDJ4phbBquFwxy+7F6h3n+0HHfqo7T+Na6REWoVqiTG1lYBg2aTKqdVZv kUxp+5jCjY10iak= X-Sasl-enc: 0Ju/lGrTthIIA5X7p5sEIRuPpKxxSxNNClDD0E7IkaXgvXu1mkbwzNkqmp+l2A 1332825231 Date: Tue, 27 Mar 2012 07:13:43 +0200 From: Daniel Shahaf To: Richard Hartmann Cc: zsh-users@zsh.org Subject: Re: `cd .` in non-existent directory leads into weird corner case Message-ID: <20120327051343.GB27197@daniel3.local> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Richard Hartmann wrote on Tue, Mar 27, 2012 at 02:56:23 +0200: > Hi all, > > maybe I am misunderstanding zsh's intentions here, but this behaviour > seems to be quite useless/counter-intuitive and potentially harmful: > > richih@adamantium ~ % zsh -f > adamantium% PS1="%~ %# " > ~ % mkdir testdir > ~ % cd testdir > ~/testdir % rmdir ~/testdir > ~/testdir % cd . > . % ls > . % pwd > . > . % cd .. > . % pwd > . > . % > > Wouldn't it be better if zsh threw an error as soon as the user tries to `cd .`? > FWIW: stat64(".", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 chdir("/tmp/d") = -1 ENOENT (No such file or directory) stat64(".", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 chdir(".") = 0 stat64("/tmp/d", 0xbf9b00ec) = -1 ENOENT (No such file or directory) stat64(".", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 rt_sigprocmask(SIG_BLOCK, [INT], [CHLD], 8) = 0 stat64("..", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 open("..", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 which tells me two things: that there is an initial chdir() call which fails (re your suggestion to propagate that), and that the behaviour might be even weirder if you remove the parent directory as well. ('cd /tmp/d/e && rm -rf /tmp/d') > > Thanks, > Richard