zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Spurious "no match" (Re: Remind me why ${name+word} is the way it is?)
Date: Mon, 28 Nov 2016 22:44:50 -0800	[thread overview]
Message-ID: <161128224450.ZM25252@torch.brasslantern.com> (raw)
In-Reply-To: <20161123012650.GA4241@localhost.localdomain>

On Nov 23,  9:26am, Han Pingtian wrote:
} Subject: Re: Remind me why ${name+word} is the way it is?
}
} On Wed, Nov 16, 2016 at 09:34:32PM -0800, Bart Schaefer wrote:
} > On Wed, Nov 16, 2016 at 6:33 PM, Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
} > >
} > > % name=a;echo ${name:+foo[bar]}
} > > zsh: no match
} > > %
} > > url-quote-magic:10: no match
} > 
} Oh, I can still reproduce this problem by running 
} 
}     name=a;echo ${name:+foo[bar]}
} 
} two times.

So, this isn't url-quote-magic's fault -- the value of the internal C
variable badcshglob is never getting cleared after the error has been
ignored, so it trips the next time any command passes through a test
for whether a glob has failed.  Any user-defined widget that assigns
to an array ought to generate the same error.

This seems to do the right thing, but someone please review:

diff --git a/Src/subst.c b/Src/subst.c
index c7c5522..42e741a 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -411,7 +411,9 @@ globlist(LinkList list, int nountok)
 	next = nextnode(node);
 	zglob(list, node, nountok);
     }
-    if (badcshglob == 1)
+    if (noerrs)
+	badcshglob = 0;
+    else if (badcshglob == 1)
 	zerr("no match");
 }
 


  reply	other threads:[~2016-11-29  6:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161112043435epcas1p1414be9386b843c435a1f1bc6cb242af1@epcas1p1.samsung.com>
2016-11-12  4:34 ` Remind me why ${name+word} is the way it is? Bart Schaefer
2016-11-14  9:46   ` Peter Stephenson
2016-11-17  2:33   ` Han Pingtian
2016-11-17  5:34     ` Bart Schaefer
2016-11-23  1:26       ` Han Pingtian
2016-11-29  6:44         ` Bart Schaefer [this message]
2016-11-29  9:38           ` Spurious "no match" (Re: Remind me why ${name+word} is the way it is?) Peter Stephenson
2016-11-29 10:06             ` Peter Stephenson
2016-11-18  1:30     ` Remind me why ${name+word} is the way it is? Han Pingtian

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=161128224450.ZM25252@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).