Add a test for the inherited permissions regression in qcopy_acl(): if
the source file did not have an acl, qcopy_acl() did not override
permissions the destination file may have inherited.
---
 tests/cp/acl.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/cp/acl.sh b/tests/cp/acl.sh
index 418e1e989..f6d4fd64c 100755
--- a/tests/cp/acl.sh
+++ b/tests/cp/acl.sh
@@ -26,7 +26,7 @@ require_acl_
 grep '^#define USE_ACL 1' $CONFIG_HEADER > /dev/null ||
   skip_ "insufficient ACL support"
 
-mkdir -p a b || framework_failure_
+mkdir -p a/dir b || framework_failure_
 touch a/file || framework_failure_
 
 # Ensure that setfacl and getfacl work on this file system.
@@ -57,4 +57,20 @@ compare /dev/null b/file || fail=1
 acl2=$(cd b && getfacl file) || framework_failure_
 test "$acl1" = "$acl2" || fail=1
 
+# files created in b will inherit this default acl
+setfacl -d -m user:bin:rwx b || fail=1
+
+# remove the acl of a/file
+setfacl -b a/file || fail=1
+
+# copy a file, removing the inherited permissions
+cp -p a/file b/ || fail=1
+test "$(cd a && getfacl file)" = "$(cd b && getfacl file)" || fail=1
+rm -f b/file || framework_failure_
+
+# copy a directory, removing the inherited permissions
+cp -rp a/dir b/ || fail=1
+test "$(cd a && getfacl dir)" = "$(cd b && getfacl dir)" || fail=1
+rm -rf b/dir || framework_failure_
+
 Exit $fail
-- 
2.56.1


Reply via email to