[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] [PATCH] patch_format: escape all occurences of %
From: |
Andreas Grünbacher |
Subject: |
Re: [Quilt-dev] [PATCH] patch_format: escape all occurences of % |
Date: |
Wed, 5 Jun 2024 23:11:43 +0200 |
Am Mi., 5. Juni 2024 um 22:57 Uhr schrieb Jean Delvare <jdelvare@suse.de>:
> Hallo Andreas,
>
> On Tue, 14 May 2024 14:50:34 +0200, Andreas Grünbacher wrote:
> > Am Di., 14. Mai 2024 um 12:54 Uhr schrieb Andreas Schwab <schwab@suse.de>:
> > >
> > > ---
> > > quilt/scripts/patchfns.in | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
> > > index aefb279..937e804 100644
> > > --- a/quilt/scripts/patchfns.in
> > > +++ b/quilt/scripts/patchfns.in
> > > @@ -1073,7 +1073,7 @@ patch_format()
> > > {
> > > local prefix=${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}
> > >
> > > - echo -n "${prefix/\%/%%}%s"
> > > + echo -n "${prefix//%/%%}%s"
> >
> > Thanks, that's better, but since that's used as a printf format
> > string, shouldn't backslashes also be escaped, like
> > ${prefix//[%\\]/&&}?
>
> Have you tested this? I don't think "&" as a reference to the pattern
> match works in bash pattern substitution the way it does in sed
> substitutions.
No, I alway commit code completely untested. Here's a "test script":
prefix='a%b\c'; echo ${prefix//[%\\]/&&}
Andreas