Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: buggy CSH_NULL_GLOB when a pattern is at the command position
- X-seq: zsh-workers 37483
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: buggy CSH_NULL_GLOB when a pattern is at the command position
- Date: Fri, 1 Jan 2016 19:11:55 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;        h=from:message-id:date:in-reply-to:comments:references:to:subject         :mime-version:content-type;        bh=/XqpRzczfOrZkksazwUTaCFd8v8Q2pDQOmqFYnfuA8U=;        b=slM2H4wtQiEoPJV7zOOhxf7I9TOb+nRCeqxdLG3zPtWWYCkfsCqCiBjRO+LlQZWxRe         x2xXMhT59LiCju1HnvcSQ0XkQnFaLS6mqiFm1/DpRxOVsJVqsVk//mHT25glyqcTz5If         MHoP8yZMo/CFuKZgDc/a1kVY+AOnOcQc3bPNkPQqDKUS+hpBQaJEs1Rw+uBVmKxZce54         PgPJRxZdMIj0rfrjtWwAGj+ifYYiqYI49qtp5tDW/9Tburpr/lIk5mkLA3Kvoh7l6pcN         c0xQSCYB2xxhqlas5pM3WcNrGBUbGKrK4jpnpvX6qD1NvLNAftu1OIqO558nQofYaLik         4ebg==
- In-reply-to: <160101131059.ZM10597@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160101040052.GA1808@zira.vinc17.org> 	<160101123940.ZM10365@torch.brasslantern.com> 	<160101131059.ZM10597@torch.brasslantern.com>
On Jan 1,  1:10pm, Bart Schaefer wrote:
}
} I suspect badcshglob needs to be cleared (or saved/restored) somewhere.
Patch below handles this.
Here's another odd cshnullglob buglet which is present as far back as
zsh-4.2.0, perhaps farther:
torch% echo []
zsh: no match
torch% echo [] *[c]*(e?'return 0'?)
config.h
torch% echo [] *[c]*(e?'return 0'?)
config.h config.log config.modules config.modules.sh config.status Doc Etc Src
That is, the first time a no-op (e) qualifier appears after a failed
cshnullglob, exactly one file is returned, even if more matches are
possible.  This must (?) be another case of badcshglob needing to be
reset, but I haven't tracked it down yet.
diff --git a/Src/glob.c b/Src/glob.c
index 94b3f62..8bd2fc4 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -3802,13 +3802,16 @@ qualsheval(char *name, UNUSED(struct stat *buf), UNUSED(off_t days), char *str)
 
     if ((prog = parse_string(str, 0))) {
 	int ef = errflag, lv = lastval, ret;
+	int cshglob = badcshglob;
 
 	unsetparam("reply");
 	setsparam("REPLY", ztrdup(name));
+	badcshglob = 0;
 
 	execode(prog, 1, 0, "globqual");
 
-	ret = lastval;
+	if ((ret = lastval))
+	    badcshglob |= cshglob;
 	/* Retain any user interrupt error status */
 	errflag = ef | (errflag & ERRFLAG_INT);
 	lastval = lv;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author