On Mon, Nov 30, 2026 at 11:39 AM Phillip Wood <phil…@gmail.com> wrote:
> On 30/11/2026 15:19, D. Ben Knoble wrote:
> > On Fri, Nov 27, 2026 at 11:54 AM Phillip Wood <phil…@gmail.com> wrote:
> >> + } else if (*q == '}' && brace) {
> >> + brace--;
> >
> > I think this simple counter may count wrongly for scenarios like
> > "}{a,b}", but I haven't tried it myself yet. My shells (Zsh and Bash)
> > both do the following:
> >
> > $ echo }{a,b}
> > }a }b
> >
> > and I *think* that brace==0 when we see the comma here, even though it
> > would need quoted to avoid expansion.
>
> We only decrement "brace" when we see '}' if "brace > 0". If we see '}'
> when "brace == 0" then we quote everything up to the next backslash
> escape or the end of the string. So we decide to quote this before we
> see the comma.
Doh, I missed the "&& brace"---thanks!
Some other time, I (or anyone interested) should throw a fuzzer at
this and see what happens ;)