From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17979 invoked from network); 22 Mar 2009 12:55:32 -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 news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 22 Mar 2009 12:55:32 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 38319 invoked from network); 22 Mar 2009 12:55:25 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 Mar 2009 12:55:25 -0000 Received: (qmail 19993 invoked by alias); 22 Mar 2009 12:55:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26765 Received: (qmail 19975 invoked from network); 22 Mar 2009 12:55:17 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 22 Mar 2009 12:55:17 -0000 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by bifrost.dotsrc.org (Postfix) with ESMTP id C182C80590EB for ; Sun, 22 Mar 2009 13:54:27 +0100 (CET) Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090322125423.UBCE7670.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Sun, 22 Mar 2009 12:54:23 +0000 Received: from pws-pc ([81.107.42.185]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090322125423.GUAY22934.aamtaout04-winn.ispmail.ntl.com@pws-pc> for ; Sun, 22 Mar 2009 12:54:23 +0000 Date: Sun, 22 Mar 2009 12:54:10 +0000 From: Peter Stephenson To: zsh-workers Subject: Re: cd -s symlink hangs (sometimes?) Message-ID: <20090322125410.66a9d294@pws-pc> In-Reply-To: <237967ef0903201615x72769fe4va86273c3fa07cb2e@mail.gmail.com> References: <237967ef0903201412h2a7b99c9ya5101509a3972313@mail.gmail.com> <20090320224856.73dae001@pws-pc> <237967ef0903201615x72769fe4va86273c3fa07cb2e@mail.gmail.com> X-Mailer: Claws Mail 3.7.0 (GTK+ 2.14.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=ul2_IQXT8_kA:10 a=GAIXNriFaDQA:10 a=pGLkceISAAAA:8 a=NLZqzBF-AAAA:8 a=6lWaI95NQZsEUKAkbd0A:9 a=FIBcRbLG8QXf38mAwhS1j006MdYA:4 a=LY0hPdMaydYA:10 a=MSl-tDqOz04A:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.92.1/9149/Sun Mar 22 06:12:21 2009 on bifrost X-Virus-Status: Clean On Sat, 21 Mar 2009 00:15:24 +0100 Mikael Magnusson wrote: > For some more fun I tried this, and it does still break: > mkdir a > ln -s a b > cd a > chmod -x . > cd -s $PWD:h/b > #infinite loop here still This is basically the same problem. I'm not sure why when the directory is restored wrongly and you end up in "/" you are seeing this infinite loop and I'm not, but it may just be a side effect. The problem is still the code I was scratching my head over before: #ifdef HAVE_FCHDIR if (d->dirfd < 0 && (d->dirfd = open(".", O_RDONLY | O_NOCTTY)) < 0 && zgetdir(d) && *d->dirname != '/') d->dirfd = open("..", O_RDONLY | O_NOCTTY); #endif It's now being executed, but we can't open "." any more. So it's failing to save a fchdir-able directory for restoring, so after the "cd -s" fails we end up still in / again. I'm not sure if there's a full fix for this. It can probably be handled better than it is at the moment, but apart from warning the user and making sure the shell knows what directory it's actually in I'm don't really know how. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/