All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iotests/108: probe loop device setup
@ 2026-10-13 18:28 Ilya Leoshkevich
  2026-10-13 18:53 ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Leoshkevich @ 2026-10-13 18:28 UTC (permalink / raw)
  To: Kevin Wolf, Hanna Reitz; +Cc: qemu-block, qemu-devel, Ilya Leoshkevich

Running iotests/108 in a Docker container, that has passwordless sudo
configured, fails with:

    losetup: /home/user/src/qemu/build/scratch/qcow2-file-108/t.qcow2: failed to set up loop device: No such file or directory

because it incorrectly assumes losetup is allowed to do loop device
setup, when in reality it can only list devices.

Fix by probing loop device setup, using the test script as a backing
file. With this, the test is correctly skipped.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tests/qemu-iotests/108 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
index 1de718188aa..adbaaf87095 100755
--- a/tests/qemu-iotests/108
+++ b/tests/qemu-iotests/108
@@ -53,7 +53,8 @@ _supported_os Linux
 _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file
 
 # This test either needs sudo -n losetup or FUSE exports to work
-if sudo -n losetup &>/dev/null; then
+if probe_dev=$(sudo -n losetup -r --show -f "$0" 2>/dev/null); then
+    sudo -n losetup -d "$probe_dev"
     loopdev=true
 else
     loopdev=false
-- 
2.56.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-13 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 18:28 [PATCH] iotests/108: probe loop device setup Ilya Leoshkevich
2026-10-13 18:53 ` Eric Blake
2026-10-13 19:08   ` Ilya Leoshkevich
2026-10-13 19:14     ` Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.