]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls: add a test to verify that '+' is added
authorSylvestre Ledru <sylvestre@debian.org>
Wed, 10 Jan 2024 18:18:05 +0000 (19:18 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 10 Jan 2024 22:51:13 +0000 (22:51 +0000)
* tests/ls/acl.sh: Add a new test.
* tests/local.mk: Reference the new test.

tests/local.mk
tests/ls/acl.sh [new file with mode: 0755]

index d9bdb2ed5f2a626ed158194903c6b02b4691c91e..895a19ae7ac1a2b157873b2ef3e33182bad574fe 100644 (file)
@@ -611,6 +611,7 @@ all_tests =                                 \
   tests/ln/slash-decorated-nonexistent-dest.sh \
   tests/ln/target-1.sh                         \
   tests/ls/a-option.sh                         \
+  tests/ls/acl.sh                              \
   tests/ls/abmon-align.sh                      \
   tests/ls/birthtime.sh                                \
   tests/ls/block-size.sh                       \
diff --git a/tests/ls/acl.sh b/tests/ls/acl.sh
new file mode 100755 (executable)
index 0000000..04213c7
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+# verify that ls -al with acl displays the "+"
+
+# Copyright (C) 2024 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_acl_
+
+# 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
+
+Exit $fail