From: Sylvestre Ledru Date: Sun, 28 Jun 2026 12:27:46 +0000 (+0200) Subject: tests: realpath: a trailing slash must not require read permission X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9502f05a300009c4726007f6323433cda1652104;p=thirdparty%2Fcoreutils.git tests: realpath: a trailing slash must not require read permission A trailing slash only asserts that the operand is a directory. That is a stat-level check, needing search permission on the parent, not read permission on the directory itself. * tests/misc/realpath.sh: Check that a searchable but unreadable directory still resolves with a trailing slash, with and without -e. Link: https://github.com/coreutils/coreutils/pull/307 --- diff --git a/tests/misc/realpath.sh b/tests/misc/realpath.sh index 56bd8597a3..501a7baa60 100755 --- a/tests/misc/realpath.sh +++ b/tests/misc/realpath.sh @@ -111,4 +111,11 @@ else test "$out" = ".$nl." || fail=1 fi +# A trailing slash only requires the operand to be a directory, which is a +# stat-level check (search permission on the parent). A directory that is +# searchable but not readable must still resolve, not fail with EACCES. +mkdir noread && chmod a-r noread || framework_failure_ +test "$(realpath noread/)" = "$(realpath .)/noread" || fail=1 +test "$(realpath -e noread/)" = "$(realpath .)/noread" || fail=1 + Exit $fail