From: Luca Boccassi Date: Sat, 2 May 2026 22:46:46 +0000 (+0100) Subject: test: avoid getting stuck on /dev/fuse X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afa4a559e113a0b7c570806ae655c035ae962b7d;p=thirdparty%2Fsystemd.git test: avoid getting stuck on /dev/fuse On Fedora Rawhide checking /dev/fuse in the test is getting stuck and timing out: [ 47.930104] TEST-13-NSPAWN.sh[2588]: + testcase_fuse [ 47.930424] TEST-13-NSPAWN.sh[2589]: ++ cat [ 58.772538] audit: type=1131 audit(1777728357.726:778): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-importd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 901.882562] audit: type=1131 audit(1777729200.830:782): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-tmpfiles-clean comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' Finishing after writing 176921 entries qemu-system-x86_64: terminating on signal 15 from pid 70717 (/usr/bin/python3) Wrap it with a timeout to avoid getting stuck forever Follow-up for dc3223919f663b7c8b8d8d1d6072b4487df7709b --- diff --git a/test/units/TEST-13-NSPAWN.nspawn.sh b/test/units/TEST-13-NSPAWN.nspawn.sh index 47c19f08c01..0332a12f646 100755 --- a/test/units/TEST-13-NSPAWN.nspawn.sh +++ b/test/units/TEST-13-NSPAWN.nspawn.sh @@ -1350,7 +1350,10 @@ testcase_unpriv() { } testcase_fuse() { - if [[ "$(cat <>/dev/fuse 2>&1)" != 'cat: -: Operation not permitted' ]]; then + # On some kernels reading from /dev/fuse without an attached connection blocks indefinitely + # rather than returning EPERM, so guard the probe with a short timeout and skip the test + # whenever we don't get the expected error string. + if [[ "$(timeout --foreground 5 cat <>/dev/fuse 2>&1)" != 'cat: -: Operation not permitted' ]]; then echo "FUSE is not supported, skipping the test..." return 0 fi @@ -1381,7 +1384,7 @@ testcase_fuse() { # "cat: -: Operation not permitted" # pass the test; opened but not read # "bash: line 1: /dev/fuse: Operation not permitted" # fail the test; could not open # "" # fail the test; reading worked - [[ "$(systemd-nspawn --register=no --pipe --directory="$root" \ + [[ "$(timeout --foreground 30 systemd-nspawn --register=no --pipe --directory="$root" \ bash -c 'cat <>/dev/fuse' 2>&1)" == 'cat: -: Operation not permitted' ]] rm -fr "$root" @@ -1390,7 +1393,7 @@ testcase_fuse() { testcase_unpriv_fuse() { # Same as above, but for unprivileged operation. - if [[ "$(cat <>/dev/fuse 2>&1)" != 'cat: -: Operation not permitted' ]]; then + if [[ "$(timeout --foreground 5 cat <>/dev/fuse 2>&1)" != 'cat: -: Operation not permitted' ]]; then echo "FUSE is not supported, skipping the test..." return 0 fi @@ -1409,7 +1412,7 @@ testcase_unpriv_fuse() { create_dummy_ddi "$tmpdir" "$name" chown --recursive testuser: "$tmpdir" - [[ "$(run0 -u testuser --pipe systemd-run \ + [[ "$(timeout --foreground 60 run0 -u testuser --pipe systemd-run \ --user \ --pipe \ --property=Delegate=yes \