* [PATCH] dg-cmp-results: Escape slash from variant argument
@ 2023-08-11 8:10 Mikael Morin
0 siblings, 0 replies; only message in thread
From: Mikael Morin @ 2023-08-11 8:10 UTC (permalink / raw)
To: gcc-patches
Hello,
I ran into a bug recently, running dg-cmp-results.sh with variant
unix/-m32. This fixes it.
OK for master?
-- >8 --
Escape slash characters in $header variable (coming from the variant
argument). This avoids runs with say "unix/-m32" as variant resulting
in sed errors "unknown command: -".
contrib/ChangeLog:
* dg-cmp-results.sh: Escape slashes in $header to a new
variable. Use the new variable in sed command.
---
contrib/dg-cmp-results.sh | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/contrib/dg-cmp-results.sh b/contrib/dg-cmp-results.sh
index 33e0605dc50..7d17772dc75 100755
--- a/contrib/dg-cmp-results.sh
+++ b/contrib/dg-cmp-results.sh
@@ -90,8 +90,11 @@ sed $E -e '/^[[:space:]]+===/,$d' $OFILE
echo "Newer log file: $NFILE"
sed $E -e '/^[[:space:]]+===/,$d' $NFILE
+# Escape occurences of / in $header before passing through sed.
+header_pattern=`echo "$header" | sed $E -e 's:/:[/]:g'`
+
# Create a temporary file from the old file's interesting section.
-sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
+sed $E -e "/$header_pattern/,/^[[:space:]]+===.*Summary ===/!d" \
-e '/^[A-Z]+:/!d' \
-e '/^(WARNING|ERROR):/d' \
-e 's/\r$//' \
@@ -101,7 +104,7 @@ sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
>$TMPDIR/o$$-$OBASE
# Create a temporary file from the new file's interesting section.
-sed $E -e "/$header/,/^[[:space:]]+===.*Summary ===/!d" \
+sed $E -e "/$header_pattern/,/^[[:space:]]+===.*Summary ===/!d" \
-e '/^[A-Z]+:/!d' \
-e '/^(WARNING|ERROR):/d' \
-e 's/\r$//' \
--
2.40.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-11 8:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11 8:10 [PATCH] dg-cmp-results: Escape slash from variant argument Mikael Morin
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 read-only IMAP folder(s) and NNTP newsgroup(s).