Re: [PATCH] expand: Fix typo in pmatch for wildcard search

[email protected] Tue, 23 Sep 2025 15:47:21 -0500
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
I can confirm that that patch works for all of the builds that formerly failed, thanks!

On 9/23/25 10:00 AM, Herbert Xu <[email protected]> wrote:
> On Tue, Sep 23, 2025 at 12:03:20PM +0100, Harald van Dijk wrote:
> >
> > configure did/does prefer bash but can run with dash, either on systems
> > where bash is not available or when CONFIG_SHELL is set to bypass the
> > automatic switch to bash. This has been working for years, and I very much
> > suspect that if you run with a slightly older version of dash, you will see
> > that it also works for you.
> 
> Thanks, you're right.
> 
> And Reilly had already isolated the buggy commit through bisection:
> 
> ---8<---
> Skip the optimisation for * for only if the next character is
> ? and [, rather than ? and anything but [.
> 
> Reported-by: Reilly Brogan <[email protected]>
> Fixes: e878137f63e6 ("expand: Move stop array closer to strpbrk call")
> Signed-off-by: Herbert Xu <[email protected]>
> 
> diff --git a/src/expand.c b/src/expand.c
> index 992cbe8..1fab394 100644
> --- a/src/expand.c
> +++ b/src/expand.c
> @@ -1911,7 +1911,7 @@ static int pmatch(char *pattern, const char *string)
>   				c = *++p;
>   			if (!c)
>   				return 1;
> -			if (c == '?' || c != '[')
> +			if (c == '?' || c == '[')
>   				c = CTLESC;
>   			for (;;) {
>   				if (c != CTLESC) {
>