From: Pádraig Brady
Date: Fri, 10 Apr 2026 13:55:07 +0000 (+0100) Subject: tests: stat: ensure independence from /proc/ X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;p=thirdparty%2Fcoreutils.git tests: stat: ensure independence from /proc/ * tests/stat/stat-mount.sh: Ensure stat -c '%a' is independent from /proc. https://github.com/coreutils/coreutils/pull/250 --- diff --git a/tests/stat/stat-mount.sh b/tests/stat/stat-mount.sh index b630d5b52d..18b5440435 100755 --- a/tests/stat/stat-mount.sh +++ b/tests/stat/stat-mount.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Test stat -c%m +# Test stat interactions with mounts # Copyright (C) 2010-2026 Free Software Foundation, Inc. @@ -25,4 +25,12 @@ case "$stat_mnt" in *) fail=1;; esac +# Ensure stat works without mounting /proc +hide_proc() { + unshare -rm $SHELL -c 'mount -t tmpfs tmpfs /proc && "$@"' -- "$@" +} +if hide_proc true; then + hide_proc stat -c '0%#a' / || fail=1 +fi + Exit $fail