From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17119 invoked from network); 14 Jul 2009 22:31:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 14 Jul 2009 22:31:02 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 76399 invoked from network); 14 Jul 2009 22:30:56 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Jul 2009 22:30:56 -0000 Received: (qmail 16842 invoked by alias); 14 Jul 2009 22:30:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27150 Received: (qmail 16826 invoked from network); 14 Jul 2009 22:30:48 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 14 Jul 2009 22:30:48 -0000 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 8FD108027106 for ; Wed, 15 Jul 2009 00:30:45 +0200 (CEST) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MQqWK-0004BV-S4 for zsh-workers@sunsite.dk; Tue, 14 Jul 2009 22:30:45 +0000 Received: from l3-128-170-36-102.l-3com.com ([128.170.36.102]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jul 2009 22:30:44 +0000 Received: from ebb9 by l3-128-170-36-102.l-3com.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jul 2009 22:30:44 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@sunsite.dk From: Eric Blake Subject: Re: cd bugs Date: Tue, 14 Jul 2009 22:30:33 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 128.170.36.102 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)) Sender: news X-Virus-Scanned: ClamAV 0.94.2/9566/Tue Jul 14 21:57:47 2009 on bifrost X-Virus-Status: Clean Eric Blake byu.net> writes: > > POSIX requires cd to give output if a nonempty entry in CDPATH played a role, > or if 'cd -' was used. Therefore, this line demonstrates two zsh bugs: > > $ zsh -c 'emulate -R sh; cd /tmp; mkdir -p d; CDPATH=.; cd d; cd -; rmdir d' > $ bash -c 'cd /tmp; mkdir -p d; CDPATH=.; cd d; cd -; rmdir d' > /tmp/d > /tmp > $ > > while bash was correct in printing the absolute name of d and its parent. Another bug - POSIX requires that CDPATH be searched prior to ., regardless of whether CDPATH contains an explicit . or an empty entry. Therefore, this is another example where bash is right. But I think the zsh native behavior of favoring . over CDPATH if CDPATH does not include . is a little more intuitive, so this may warrant the addition of a new shell option (POSIX_CD?) that defaults to off in zsh mode but defaults to on in sh mode for POSIX compliance. $ zsh -c 'emulate -R sh; cd /tmp; mkdir -p a/b b; CDPATH=a; cd b; /bin/pwd' /tmp/b $ bash -c 'cd /tmp; mkdir -p a/b b; CDPATH=a; cd b; /bin/pwd' /tmp/a/b /tmp/a/b $ cd /tmp; rm -Rf a b $ -- Eric Blake