Blame SOURCES/coreutils-8.22-tests-setfacl.patch

886e95
From f35af907e2d340a0fca1eb3ac07f7cf0eafe0a03 Mon Sep 17 00:00:00 2001
886e95
From: Bernhard Voelker <mail@bernhard-voelker.de>
886e95
Date: Fri, 10 Jan 2014 16:48:25 +0100
886e95
Subject: [PATCH] tests: improve test for a working setfacl
886e95
886e95
Prompted by a test framework failure of tests/mkdir/p-acl.sh on armv7l:
886e95
The previous test for a working setfacl was not sufficient in some
886e95
circumstances.
886e95
886e95
* init.cfg (require_setfacl_): Call setfacl twice with conflictive
886e95
ACL specs, and use ACL specs which can't be mapped into regular file
886e95
permission bits.  Document the reasons.
886e95
886e95
Upstream-commit: 5d7591d0edf0dd31c2daa195ee766c1383b89f4c
886e95
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
886e95
---
886e95
 init.cfg | 30 +++++++++++++++++++++++++++++-
886e95
 1 file changed, 29 insertions(+), 1 deletion(-)
886e95
886e95
diff --git a/init.cfg b/init.cfg
886e95
index d5a80bb..2d95626 100644
886e95
--- a/init.cfg
886e95
+++ b/init.cfg
886e95
@@ -192,9 +192,37 @@ require_valgrind_()
886e95
     skip_ "requires a working valgrind"
886e95
 }
886e95
 
886e95
+# Skip the current test if setfacl doesn't work on the current file system,
886e95
+# which could happen if not installed, or if ACLs are not supported by the
886e95
+# kernel or the file system, or are turned off via mount options.
886e95
+#
886e95
+# Work around the following two issues:
886e95
+#
886e95
+# 1) setfacl maps ACLs into file permission bits if on "noacl" file systems.
886e95
+#
886e95
+# On file systems which do not support ACLs (e.g. ext4 mounted with -o noacl),
886e95
+# setfacl operates on the regular file permission bits, and only fails if the
886e95
+# given ACL spec does not fit into there.  Thus, to test if ACLs really work
886e95
+# on the current file system, pass an ACL spec which can't be mapped that way.
886e95
+# "Default" ACLs (-d) seem to fulfill this requirement.
886e95
+#
886e95
+# 2) setfacl only invokes the underlying system call if the ACL would change.
886e95
+#
886e95
+# If the given ACL spec would not change the ACLs on the file, then setfacl
886e95
+# does not invoke the underlying system call - setxattr().  Therefore, to test
886e95
+# if setting ACLs really works on the current file system, call setfacl twice
886e95
+# with conflictive ACL specs.
886e95
 require_setfacl_()
886e95
 {
886e95
-  setfacl -m user::rwx . \
886e95
+  local d='acltestdir_'
886e95
+  mkdir $d || framework_failure_
886e95
+  local f=0
886e95
+
886e95
+  setfacl -d -m user::r-x $d \
886e95
+    && setfacl -d -m user::rwx $d \
886e95
+    || f=1
886e95
+  rm -rf $d || framework_failure_
886e95
+  test $f = 0 \
886e95
     || skip_ "setfacl does not work on the current file system"
886e95
 }
886e95
 
886e95
-- 
886e95
2.25.4
886e95