[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] [PATCH] Avoid warnings with grep 3.8
From: |
Jean Delvare |
Subject: |
Re: [Quilt-dev] [PATCH] Avoid warnings with grep 3.8 |
Date: |
Thu, 8 Sep 2022 13:12:00 +0200 |
Hallo Andreas,
Thanks for the quick review.
On Thu, 8 Sep 2022 12:58:16 +0200, Andreas Grünbacher wrote:
> Am Do., 8. Sept. 2022 um 11:53 Uhr schrieb Jean Delvare <jdelvare@suse.de>:
> > GNU grep version 3.8 became more strict about needless quoting in
> > patterns. We have one occurrence of that in quilt, where "/"
> > characters are being quoted by default. There are cases where they
> > indeed need to be quoted (typically when used in a sed s/// command)
> > but most of the time they do not, and this results in the following
> > warning:
> >
> > grep: warning: stray \ before /
> >
> > So make quoting of "/" by quote_bre() optional, and off by default.
> >
> > Signed-off-by: Jean Delvare <jdelvare@suse.de>
> > ---
> > As reported here:
> > https://bugzilla.opensuse.org/show_bug.cgi?id=1203230
> >
> > quilt/diff.in | 2 +-
> > quilt/scripts/patchfns.in | 7 +++++--
> > 2 files changed, 6 insertions(+), 3 deletions(-)
> >
> > --- quilt.orig/quilt/scripts/patchfns.in 2022-09-08
> > 11:06:22.647974801 +0200
> > +++ quilt/quilt/scripts/patchfns.in 2022-09-08 11:27:26.506609417 +0200
> > @@ -79,9 +79,12 @@ array_join()
> > }
> >
> > # Quote a string for use in a basic regular expression.
> > +# Optional second parameter can be used to quote an additional character,
> > +# typically '/' when the quoted regular expression is used in a sed s///
> > +# command.
> > quote_bre()
> > {
> > - echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g'
> > + echo "$1" | sed -e 's:\([][^$.*\\'$2']\):\\\1:g'
> > }
>
> Hmm, can you replace quote_bre() with a quote_grep_re() and a
> quote_sed_re() function instead?
Ah ah, that was my plan A, and then I thought keeping a single function
would be less change. Oh well. Version 2 of the patch is coming, stay
tuned.
--
Jean Delvare
SUSE L3 Support