All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH] iotests/108: probe loop device setup
Date: Tue, 13 Oct 2026 20:28:00 +0200	[thread overview]
Message-ID: <20261013182804.103882-1-iii@linux.ibm.com> (raw)

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



             reply	other threads:[~2026-10-13 18:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 18:28 Ilya Leoshkevich [this message]
2026-10-13 18:53 ` [PATCH] iotests/108: probe loop device setup Eric Blake
2026-10-13 19:08   ` Ilya Leoshkevich
2026-10-13 19:14     ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261013182804.103882-1-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.