From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16937 invoked by alias); 26 Feb 2015 04:56:23 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34634 Received: (qmail 17956 invoked from network); 26 Feb 2015 04:56:20 -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.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=xeu7i0Cw3e75iNZPOS7kbSsOCLPjCtPA7qer/1s3oCo=; b=e63humH/CIkKFowfP+Q+pfmJT++h6/UjnP2Cq6uUJ8h0mTTfiwkmkZUoplQs/UWpzX cq2l0ASCbxh7tyUuTIw9OQg4SeuwBTF++GgBC01kmOylyy3SMJczem4GeF6xhc5nkvti IGEdz12mitkgt/d7TD5I16BzxhROVqNDFv6yqYCDnTd9XVeaU3QIwRB4L7RdxHV43Bke hpCkRIUYPMm4kkG8TluAHDAKEnDdpwebZIaR5U3Sv1SP+ZP3TNcw13wlF9T4y3eEEDVj M8Upoi7eJuZPAFM4/UXTyXf0MUG3U2bUnW51nVe3qsN2CnZa7OikVvX88v4wP7MfhRW4 aeHA== X-Gm-Message-State: ALoCoQmNRFowwxVsUg7kCZsD0U+r2rbL9O2BexoduATe/3y9Vw2XD3IDVIrWjJp9q8/AJfoMmm1b MIME-Version: 1.0 X-Received: by 10.194.179.194 with SMTP id di2mr12817288wjc.4.1424926577033; Wed, 25 Feb 2015 20:56:17 -0800 (PST) In-Reply-To: <54EE6DFF.7010901@gmx.com> References: <54EE6DFF.7010901@gmx.com> Date: Wed, 25 Feb 2015 20:56:16 -0800 Message-ID: Subject: Re: extendedglob recursion (/)# From: Bart Schaefer To: Zsh hackers list Content-Type: text/plain; charset=UTF-8 (Apologies if this ends up appearing multiple times. Outgoing mail from my home machine has mysteriously stopped working [I blame Verizon] so I'm pasting the message into gmail while I figure out what the heck is going on.) On Feb 25, 7:51pm, Eric Cook wrote: } } Mikachu | % pl (/)#|wc -l } Mikachu | glob.c:276: BUG: statfullpath(): pathname too long } } What should the 'proper' behavior be? Recursing into directories below / } or just printing `/' Recursing into directories below / would definitely be wrong (and would in any case need to fail with "no match" because there can only be the one directory named "/"). There's a pretty straightforward fix: diff --git a/Src/glob.c b/Src/glob.c index 82f8d62..f48cb8e 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -708,7 +708,8 @@ parsecomplist(char *instr) } l1 = (Complist) zhalloc(sizeof *l1); l1->pat = p1; - l1->closure = 1 + pdflag; + /* special case (/)# to avoid infinite recursion */ + l1->closure = (p1->patmlen > 0) ? 1 + pdflag : 0; l1->follow = 0; l1->next = parsecomplist(instr); return (l1->pat) ? l1 : NULL;