aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-01-17 17:29:34 +0000
committerPádraig Brady <P@draigBrady.com>2025-01-18 13:14:29 +0000
commit915004f403cb25fadb207ddfdbe6a2f43bd44fac (patch)
treee5ccb62598e26f396c59584391a4f895b3d7face /tests
parentmaint: post-release administrivia (diff)
downloadcoreutils-915004f403cb25fadb207ddfdbe6a2f43bd44fac.tar.gz
coreutils-915004f403cb25fadb207ddfdbe6a2f43bd44fac.zip
ls: fix crash with --context
* src/ls.c (main): Flag that we need to stat() if we're going to get security context (call file_has_aclinfo_cache). (file_has_aclinfo_cache): Be defensive and only lookup the device for the file if the stat has been performed. (has_capability_cache): Likewise. * tests/ls/selinux-segfault.sh: Add a test case. * NEWS: Mention the bug fix. Reported by Bruno Haible.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ls/selinux-segfault.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/ls/selinux-segfault.sh b/tests/ls/selinux-segfault.sh
index 11623acb3..1cac2b5fc 100755
--- a/tests/ls/selinux-segfault.sh
+++ b/tests/ls/selinux-segfault.sh
@@ -30,4 +30,7 @@ mkdir sedir || framework_failure_
ln -sf missing sedir/broken || framework_failure_
returns_ 1 ls -L -R -Z -m sedir > out || fail=1
+# ls 9.6 would segfault with the following
+ls -Z . > out || fail=1
+
Exit $fail