Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Spurious "no match" (Re: Remind me why ${name+word} is the way it is?)



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@xxxxxxxxxxxxxxxxxx> 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");
 }
 



Messages sorted by: Reverse Date, Date, Thread, Author