zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: extendedglob recursion (/)#
Date: Thu, 26 Feb 2015 08:52:38 -0800	[thread overview]
Message-ID: <150226085238.ZM6868@torch.brasslantern.com> (raw)
In-Reply-To: <CAH+w=7YRrikb7Ydwze+2Rq88nzOmvqynmG_N5Zbjc7PVZLm9Ag@mail.gmail.com>

On Feb 25,  8:56pm, Bart Schaefer wrote:
}
} +        /* special case (/)# to avoid infinite recursion */
} +        l1->closure = (p1->patmlen > 0) ? 1 + pdflag : 0;

Sorry, that's not correct.  patmlen can be zero in cases other than (/).

diff --git a/Src/glob.c b/Src/glob.c
index 82f8d62..33facde 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 = (*((char *)p1 + p1->startoff)) ? 1 + pdflag : 0;
 	    l1->follow = 0;
 	    l1->next = parsecomplist(instr);
 	    return (l1->pat) ? l1 : NULL;


      reply	other threads:[~2015-02-26 16:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  0:51 Eric Cook
2015-02-26  3:22 ` Eric Cook
2015-02-26  4:56 ` Bart Schaefer
2015-02-26 16:52   ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150226085238.ZM6868@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).