* Regression in quoted remove-longest-prefix expansion
@ 2025-02-22 7:57 Johannes Altmanninger
2025-03-09 8:51 ` expand: Fix scanright zero handling when fnmatch is disabled Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Altmanninger @ 2025-02-22 7:57 UTC (permalink / raw)
To: dash
I noticed another regression in c5bf970 (expand: Add multi-byte
support to pmatch, 2024-06-02).
This command now prints "abc-def" but used to print "ef".
x=abc-def
y="${x##*d}"
echo "$y"
^ permalink raw reply [flat|nested] 3+ messages in thread
* expand: Fix scanright zero handling when fnmatch is disabled
2025-02-22 7:57 Regression in quoted remove-longest-prefix expansion Johannes Altmanninger
@ 2025-03-09 8:51 ` Herbert Xu
2025-03-17 9:09 ` Johannes Altmanninger
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2025-03-09 8:51 UTC (permalink / raw)
To: Johannes Altmanninger; +Cc: dash
Johannes Altmanninger <aclopte@gmail.com> wrote:
> I noticed another regression in c5bf970 (expand: Add multi-byte
> support to pmatch, 2024-06-02).
>
> This command now prints "abc-def" but used to print "ef".
>
> x=abc-def
> y="${x##*d}"
> echo "$y"
Fix this by setting s to the correct value in scanright based
on FNMATCH_IS_ENABLED.
Fixes: c5bf9702ea11 ("expand: Add multi-byte support to pmatch")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/src/expand.c b/src/expand.c
index 7a30648..0066e1a 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -650,7 +650,7 @@ static char *scanright(char *startp, char *endp, char *rmesc, char *rmescend,
if (zero) {
*s = '\0';
- s = rmesc;
+ s = FNMATCH_IS_ENABLED ? rmesc : startp;
}
match = pmatch(str, s);
*(FNMATCH_IS_ENABLED ? loc2 : loc) = c;
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: expand: Fix scanright zero handling when fnmatch is disabled
2025-03-09 8:51 ` expand: Fix scanright zero handling when fnmatch is disabled Herbert Xu
@ 2025-03-17 9:09 ` Johannes Altmanninger
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Altmanninger @ 2025-03-17 9:09 UTC (permalink / raw)
To: Herbert Xu; +Cc: dash
On Sun, Mar 09, 2025 at 04:51:53PM +0800, Herbert Xu wrote:
> Johannes Altmanninger <aclopte@gmail.com> wrote:
> > I noticed another regression in c5bf970 (expand: Add multi-byte
> > support to pmatch, 2024-06-02).
> >
> > This command now prints "abc-def" but used to print "ef".
> >
> > x=abc-def
> > y="${x##*d}"
> > echo "$y"
>
> Fix this by setting s to the correct value in scanright based
> on FNMATCH_IS_ENABLED.
>
> Fixes: c5bf9702ea11 ("expand: Add multi-byte support to pmatch")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/src/expand.c b/src/expand.c
> index 7a30648..0066e1a 100644
> --- a/src/expand.c
> +++ b/src/expand.c
> @@ -650,7 +650,7 @@ static char *scanright(char *startp, char *endp, char *rmesc, char *rmescend,
>
> if (zero) {
> *s = '\0';
> - s = rmesc;
> + s = FNMATCH_IS_ENABLED ? rmesc : startp;
Seems to work, thanks. I can go back to running master now (with
https://lore.kernel.org/dash/ZzlT_1CY5AjxtqAs@gondor.apana.org.au/
applied too)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-17 9:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-22 7:57 Regression in quoted remove-longest-prefix expansion Johannes Altmanninger
2025-03-09 8:51 ` expand: Fix scanright zero handling when fnmatch is disabled Herbert Xu
2025-03-17 9:09 ` Johannes Altmanninger
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).