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 <[email protected]>
---
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'
 }
 
 # Quote a string for use in an extended regular expression.
@@ -631,7 +634,7 @@ files_in_patch()
        then
                find "$path" -type f \
                               -a ! -path "$(quote_glob "$path")/.timestamp" |
-               sed -e "s/$(quote_bre "$path")\///"
+               sed -e "s/$(quote_bre "$path" /)\///"
        fi
 }
 
--- quilt.orig/quilt/diff.in    2021-06-10 17:14:19.062768258 +0200
+++ quilt/quilt/diff.in 2022-09-08 11:20:54.317134342 +0200
@@ -255,7 +255,7 @@ then
        # Add all files in the snapshot into the file list (they may all
        # have changed).
        files=( $(find $QUILT_PC/$snap_subdir -type f \
-                 | sed -e "s/^$(quote_bre $QUILT_PC/$snap_subdir/)//" \
+                 | sed -e "s/^$(quote_bre $QUILT_PC/$snap_subdir/ /)//" \
                  | sort) )
        printf "%s\n" "${files[@]}" >&4
        unset files


-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to