From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3519 invoked from network); 6 Apr 2009 11:07:53 -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; 6 Apr 2009 11:07:53 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 75562 invoked from network); 6 Apr 2009 11:07:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Apr 2009 11:07:47 -0000 Received: (qmail 3510 invoked by alias); 6 Apr 2009 11:07:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26813 Received: (qmail 3497 invoked from network); 6 Apr 2009 11:07:42 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 6 Apr 2009 11:07:42 -0000 Received: from mail-bw0-f170.google.com (mail-bw0-f170.google.com [209.85.218.170]) by bifrost.dotsrc.org (Postfix) with ESMTP id 5DF3F82D4B6A for ; Mon, 6 Apr 2009 13:07:37 +0200 (CEST) Received: by bwz18 with SMTP id 18so1756378bwz.45 for ; Mon, 06 Apr 2009 04:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=FhUPIMELABuiQXJFYvQbDHMCQV9BTYcdPpeN0etI9kg=; b=Z/z2H/Ynm5oOQYaFjv7wprk5kzcQQSffKGYg9ZPoMwFdq+P2bVFiK5lr3CoYpzkFkK R2GAIWOfhdCmiyoUkzri7dU8qpXPNuzSkRBZ4ECrYmyfHDyLzFfyd5viqMOErpX4cr5G mALkXQ0rFD0+jbG7tMgloYNIIaxXHA+VHGtaA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=J59wXdBikYBhCqSPzvw23bCWHooPR9w60/F0N2qcn5B8ARykBTSSFxTptQgFa1mBc2 4h1Aei9hMjX+XUeE4CFxpt6m4TbdavhCFlpLuSg4REPunxADXOOX+zZv3qSxZB2Osr11 qjFxpUf0SpGbPasSUMMyObMbwd96L+HaMiup0= MIME-Version: 1.0 Received: by 10.204.102.76 with SMTP id f12mr1601281bko.137.1239016057707; Mon, 06 Apr 2009 04:07:37 -0700 (PDT) In-Reply-To: <20090324124612.26017e86@news01> References: <237967ef0903201412h2a7b99c9ya5101509a3972313@mail.gmail.com> <20090320224856.73dae001@pws-pc> <237967ef0903201615x72769fe4va86273c3fa07cb2e@mail.gmail.com> <20090322125410.66a9d294@pws-pc> <237967ef0903221605h11983bb4v4eda8d2a1c41a1c9@mail.gmail.com> <20090323104928.0c59c30f@news01> <237967ef0903230446u6810c06cs511fddcc21fd2a8a@mail.gmail.com> <20090323122714.3373526a@news01> <20090324124612.26017e86@news01> Date: Mon, 6 Apr 2009 13:07:37 +0200 Message-ID: <237967ef0904060407r657c3bfbp132ed4350e66524f@mail.gmail.com> Subject: Re: cd -s symlink hangs (sometimes?) From: Mikael Magnusson To: zsh-workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV 0.92.1/9206/Sun Apr 5 20:23:11 2009 on bifrost X-Virus-Status: Clean 2009/3/24 Peter Stephenson : > On Mon, 23 Mar 2009 12:27:14 +0000 > Peter Stephenson wrote: >> On Mon, 23 Mar 2009 12:46:10 +0100 >> Mikael Magnusson wrote: >> > 2009/3/23 Peter Stephenson : >> > Trying the patch now and it does stop the leak... but you didn't think >> > this adventure was over yet, did you? >> >> No, I definitely want to fix the diagnostics and at the least the intern= al >> setting of pwd when a cd fails, but I'm not sure what a neat way is. > > On top of this, I've found another pre-existing bug down to poorly though= t > out code structure, which may be something to do with the side effect > Mikael was seeing: =C2=A0on failure, restoredir() could call upchdir() > repeatedly because it thought it was doing a recursive glob since the "le= vel" > element wasn't initialised. =C2=A0I only got this sometimes with an optim= ised > compilation; before, I was using a debug build which didn't show it up at > all. =C2=A0I've now put the initialisation for a "struct dirsav" in a > subroutine. > > For the diagnostics and pwd, I've just borrowed what the recursive handli= ng > in zsh/files does, which is cd to /, set pwd consistently, and report the > error. =C2=A0This is at least much better; an algorithm for fixing up the > current directory even better is a good deal more complicated and given y= ou > can't cd to the correct directory in this case it's not clear how useful = it > is. =C2=A0So I'm tempted to leave it at this. > > In addition to "cd -s", this may address theoretical problems with recurs= ive > globs under similar circumstances. I wasn't able to make it happen, but is it possible that under some circumstance, a command of the form /unimportant/dir% ls **/*; rm -rf * could now remove everything in my home directory? --=20 Mikael Magnusson