mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
On systems where the security context reports as unsupported, and we encountered a file without ACLs, no further lookups would be performed. Introduced in commit v9.5-156-gb857d66b5. This fix is along similar lines as commit v9.6-40-gcb2abbac7. * src/ls.c (file_has_aclinfo_cache): Don't mark file system as unsupported if there might be ACLs or capabilities present. * tests/ls/acl-cache.sh: Add a new test. * tests/local.mk: Reference the new test. * tests/ls/acl.sh: Add a check. * NEWS: Mention the bug fix.
61 lines
1.9 KiB
Bash
Executable File
61 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
# verify that ls -al with acl displays the "+"
|
|
|
|
# Copyright (C) 2024-2026 Free Software Foundation, Inc.
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
|
print_ver_ ls
|
|
|
|
require_setfacl_
|
|
|
|
# Skip this test if ls was built without ACL support:
|
|
grep '^#define USE_ACL 1' $CONFIG_HEADER > /dev/null ||
|
|
skip_ "insufficient ACL support"
|
|
|
|
mkdir k || framework_failure_
|
|
|
|
setfacl -d -m user::rwx k 2> /dev/null || framework_failure_
|
|
getfacl k | grep 'default:' || skip_ 'default ACL not set'
|
|
|
|
ls_l=$(ls -ld k) || fail=1
|
|
|
|
case $ls_l in
|
|
d[rwxsStT-]*+\ *) ;;
|
|
*) fail=1; ;;
|
|
esac
|
|
|
|
# Verify appropriate alignment in the presence of ACLs
|
|
uid=$(id -u) || framework_failure_
|
|
mkdir pad &&
|
|
(
|
|
cd pad &&
|
|
touch f1 f2 f3 f4 f5 &&
|
|
setfacl -m "u:${uid}:rw" f1 f2 f3 f4 f5
|
|
) || framework_failure_
|
|
|
|
# The gap between the '+' indicator and the link count must be the same
|
|
# whether the listing contains one or several ACL entries.
|
|
gap1=$(ls -l pad/f1 | sed -n 's/^[^+]*+\( *\)[0-9].*/\1/p')
|
|
gap5=$(ls -l pad | sed -n 's/^[^+]*+\( *\)[0-9].*/\1/p' | head -n1)
|
|
test "x$gap1" = "x$gap5" || fail=1
|
|
|
|
# A file without an ACL must not suppress ACLs on subsequent files.
|
|
touch pad/plain && setfacl -b pad/plain || framework_failure_
|
|
ls -l pad/f1 pad/plain pad/f1 > out || fail=1
|
|
test "$(grep -c '^..........+' out)" = 2 || fail=1
|
|
|
|
Exit $fail
|