From: Frantisek Sumsal Date: Wed, 27 Mar 2024 18:35:30 +0000 (+0100) Subject: test: check for /dev/loop-control when checking lodev availability X-Git-Tag: v256-rc1~371^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0348b500efea840b711903124b30174f97b9ae68;p=thirdparty%2Fsystemd.git test: check for /dev/loop-control when checking lodev availability losetup in util-linux 2.40 started reporting lost loop devices [0] and it has an unfortunate side-effect where it reports lost devices even in containers, which then makes the loop device check "falsely" pass [1]. Let's just check for /dev/loop-control explicitly to "work around" this. [0] https://github.com/util-linux/util-linux/commit/a6ca0456cc6d704a786f6b66d8bb2d89ff18eba7 [1] https://github.com/util-linux/util-linux/issues/2824 --- diff --git a/test/units/testsuite-72.sh b/test/units/testsuite-72.sh index 953f2a16bf2..de657a27ff4 100755 --- a/test/units/testsuite-72.sh +++ b/test/units/testsuite-72.sh @@ -22,7 +22,7 @@ fi # change the sector size of a file, and we want to test both 512 and 4096 byte # sectors. If loopback devices are not supported, we can only test one sector # size, and the underlying device is likely to have a sector size of 512 bytes. -if ! losetup --find >/dev/null 2>&1; then +if [[ ! -e /dev/loop-control ]]; then echo "No loopback device support" SECTOR_SIZES="512" fi @@ -108,7 +108,7 @@ for sector_size in $SECTOR_SIZES ; do rm -f "$BACKING_FILE" truncate -s "$disk_size" "$BACKING_FILE" - if losetup --find >/dev/null 2>&1; then + if [[ -e /dev/loop-control ]]; then # shellcheck disable=SC2086 blockdev="$(losetup --find --show --sector-size $sector_size $BACKING_FILE)" else