]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: allow paths in tests to contain '@' char
authorDavid Anes <david.anes@suse.com>
Fri, 9 Dec 2022 17:09:31 +0000 (18:09 +0100)
committerDavid Anes <david.anes@suse.com>
Fri, 9 Dec 2022 17:13:18 +0000 (18:13 +0100)
Tests fail when the build directory contains
'@' in its path, as its sent to 'sed' unescaped.

This patch allows to build in such environments,
which typically happen on automated systems (for
example, when building concurrently with Jenkins).

tests/functions.sh
tests/ts/minix/fsck

index 22bfc24c9368719f3cd8630e17edc1a32a969232..6975930e33d3655a810e9030c129788b121ed268 100644 (file)
@@ -853,7 +853,9 @@ function ts_fdisk_clean {
 
        # remove non comparable parts of fdisk output
        if [ -n "${DEVNAME}" ]; then
-               sed -i -e "s@${DEVNAME}@<removed>@;" $TS_OUTPUT $TS_ERRLOG
+               # escape "@" with "@@" in $img. This way sed correctly
+               # replaces paths containing "@" characters
+               sed -i -e "s@${DEVNAME//\@/\\\@}@<removed>@;" $TS_OUTPUT $TS_ERRLOG
        fi
 
        sed -i \
index 335f180dcccf5296de9bf33672e0734c8565d9dd..f246a87a7617af1a6f51503409ac7edeb7ef7ff4 100755 (executable)
@@ -50,7 +50,10 @@ done
 
 rm -f $img
 
-sed -i "s@$img@image@g" $TS_OUTPUT
+# escape "@" with "@@" in $img. This way sed correctly
+# replaces paths containing "@" characters
+sed -i "s@${img//\@/\\\@}@image@g" $TS_OUTPUT
+
 
 ts_finalize