Skip to content

Commit f8c6b3d

Browse files
andy5995claude
andcommitted
test: use /proc/mounts instead of df+awk to check /tmp mount
awk is not available in all CI containers. /proc/mounts is a standard Linux procfs file with no external tool dependencies; grep on its second field reliably detects whether /tmp is its own top-level mount point. On macOS/BSD where /proc/mounts does not exist the grep exits non-zero and the test skips silently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 44c56d5 commit f8c6b3d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/test_media_root.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ else
2121
fi
2222

2323
# This test requires /tmp to be a top-level mount point on its own device so
24-
# that rmw will write a relative Path in the trashinfo. Skip if that condition
25-
# isn't met (e.g. containers where /tmp is on the root filesystem, or macOS
26-
# where /tmp is a symlink into the root partition).
27-
tmp_mount=$(df -P /tmp 2>/dev/null | awk 'NR==2 {print $NF}')
28-
if [ "$tmp_mount" != "/tmp" ]; then
29-
echo "/tmp is not a top-level mount point (got: ${tmp_mount:-unavailable}); skipping"
24+
# that rmw will write a relative Path in the trashinfo. Check /proc/mounts
25+
# (Linux); on macOS/BSD where it doesn't exist the grep fails and we skip.
26+
if ! grep -q '^[^ ]* /tmp ' /proc/mounts 2>/dev/null; then
27+
echo "/tmp is not a top-level mount point; skipping"
3028
exit 0
3129
fi
3230

0 commit comments

Comments
 (0)