All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Altmanninger <aclopte@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: dash@vger.kernel.org
Subject: Re: expand: Fix scanright zero handling when fnmatch is disabled
Date: Mon, 17 Mar 2025 10:09:39 +0100	[thread overview]
Message-ID: <Z9fm07IjSZ3Ym3NB@gmail.com> (raw)
In-Reply-To: <Z81WqTBtj9TRqQzy@gondor.apana.org.au>

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)

      reply	other threads:[~2025-03-17  9:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=Z9fm07IjSZ3Ym3NB@gmail.com \
    --to=aclopte@gmail.com \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.