From: David Anes Date: Fri, 9 Dec 2022 17:09:31 +0000 (+0100) Subject: tests: allow paths in tests to contain '@' char X-Git-Tag: v2.39-rc1~379 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=057579455a40d0cc7612938aa3d11a02b279e89c;p=thirdparty%2Futil-linux.git tests: allow paths in tests to contain '@' char 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). --- diff --git a/tests/functions.sh b/tests/functions.sh index 22bfc24c93..6975930e33 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -853,7 +853,9 @@ function ts_fdisk_clean { # remove non comparable parts of fdisk output if [ -n "${DEVNAME}" ]; then - sed -i -e "s@${DEVNAME}@@;" $TS_OUTPUT $TS_ERRLOG + # escape "@" with "@@" in $img. This way sed correctly + # replaces paths containing "@" characters + sed -i -e "s@${DEVNAME//\@/\\\@}@@;" $TS_OUTPUT $TS_ERRLOG fi sed -i \ diff --git a/tests/ts/minix/fsck b/tests/ts/minix/fsck index 335f180dcc..f246a87a76 100755 --- a/tests/ts/minix/fsck +++ b/tests/ts/minix/fsck @@ -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