dg-cmp-results: Escape slash from variant argument
Checks
Commit Message
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(-)
@@ -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$//' \