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: Wed, 25 Feb 2015 20:56:16 -0800	[thread overview]
Message-ID: <CAH+w=7YRrikb7Ydwze+2Rq88nzOmvqynmG_N5Zbjc7PVZLm9Ag@mail.gmail.com> (raw)
In-Reply-To: <54EE6DFF.7010901@gmx.com>

(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;


  parent reply	other threads:[~2015-02-26  4:56 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 [this message]
2015-02-26 16:52   ` Bart Schaefer

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='CAH+w=7YRrikb7Ydwze+2Rq88nzOmvqynmG_N5Zbjc7PVZLm9Ag@mail.gmail.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).