]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls: verify correct alignment with ACLs
authorSylvestre Ledru <sylvestre@debian.org>
Sun, 12 Apr 2026 20:18:13 +0000 (22:18 +0200)
committerPádraig Brady <P@draigBrady.com>
Tue, 5 May 2026 14:33:55 +0000 (15:33 +0100)
* tests/ls/acl.sh: Check that the gap between the '+' indicator and
the link count is the same whether the listing contains one or
several ACL entries.
https://github.com/coreutils/coreutils/pull/251

tests/ls/acl.sh

index bea3942db55d9f5c25caee1f15735ccfb6bdf072..74e63226b5536aeab5c49c9b7fe33c6ba8c5f6b1 100755 (executable)
@@ -37,4 +37,19 @@ case $ls_l in
   *) 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
+
 Exit $fail