2014-01-24 14:44:10 +01:00
|
|
|
tests: avoid test framework failure if the file system lacks ACL support
|
|
|
|
|
2014-02-24 15:21:36 +01:00
|
|
|
Prompted by a test framework failure of tests/mkdir/p-acl.sh on VMs
|
|
|
|
where filesystem are mounted without ACL support.
|
2014-01-24 14:44:10 +01:00
|
|
|
I pushed the following patch upstream which will go into 8.23 some day.
|
|
|
|
_______________________________________________
|
|
|
|
|
|
|
|
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=5d7591d0
|
|
|
|
|
|
|
|
commit 5d7591d0edf0dd31c2daa195ee766c1383b89f4c
|
|
|
|
Author: Bernhard Voelker <mail@bernhard-voelker.de>
|
|
|
|
Date: Fri Jan 10 16:48:25 2014 +0100
|
|
|
|
|
|
|
|
tests: improve test for a working setfacl
|
|
|
|
|
|
|
|
Prompted by a test framework failure of tests/mkdir/p-acl.sh on armv7l:
|
|
|
|
The previous test for a working setfacl was not sufficient in some
|
|
|
|
circumstances.
|
|
|
|
|
|
|
|
* init.cfg (require_setfacl_): Call setfacl twice with conflictive
|
|
|
|
ACL specs, and use ACL specs which can't be mapped into regular file
|
|
|
|
permission bits. Document the reasons.
|
|
|
|
---
|
2014-02-24 15:21:36 +01:00
|
|
|
init.cfg | 32 ++++++++++++++++++++++++++++++--
|
|
|
|
1 file changed, 30 insertions(+), 2 deletions(-)
|
2014-01-24 14:44:10 +01:00
|
|
|
|
|
|
|
Index: init.cfg
|
|
|
|
===================================================================
|
2014-02-24 15:21:36 +01:00
|
|
|
--- init.cfg.orig 2014-02-24 15:19:12.185467061 +0100
|
|
|
|
+++ init.cfg 2014-02-24 15:20:46.802273660 +0100
|
|
|
|
@@ -192,10 +192,38 @@ require_valgrind_()
|
2014-01-24 14:44:10 +01:00
|
|
|
skip_ "requires a working valgrind"
|
|
|
|
}
|
|
|
|
|
|
|
|
+# Skip the current test if setfacl doesn't work on the current file system,
|
|
|
|
+# which could happen if not installed, or if ACLs are not supported by the
|
|
|
|
+# kernel or the file system, or are turned off via mount options.
|
|
|
|
+#
|
|
|
|
+# Work around the following two issues:
|
|
|
|
+#
|
|
|
|
+# 1) setfacl maps ACLs into file permission bits if on "noacl" file systems.
|
|
|
|
+#
|
|
|
|
+# On file systems which do not support ACLs (e.g. ext4 mounted with -o noacl),
|
|
|
|
+# setfacl operates on the regular file permission bits, and only fails if the
|
|
|
|
+# given ACL spec does not fit into there. Thus, to test if ACLs really work
|
|
|
|
+# on the current file system, pass an ACL spec which can't be mapped that way.
|
|
|
|
+# "Default" ACLs (-d) seem to fulfill this requirement.
|
|
|
|
+#
|
|
|
|
+# 2) setfacl only invokes the underlying system call if the ACL would change.
|
|
|
|
+#
|
|
|
|
+# If the given ACL spec would not change the ACLs on the file, then setfacl
|
|
|
|
+# does not invoke the underlying system call - setxattr(). Therefore, to test
|
|
|
|
+# if setting ACLs really works on the current file system, call setfacl twice
|
|
|
|
+# with conflictive ACL specs.
|
|
|
|
require_setfacl_()
|
|
|
|
{
|
|
|
|
- setfacl -m user::rwx . \
|
2014-02-24 15:21:36 +01:00
|
|
|
- || skip_ "setfacl does not work on the current file system"
|
2014-01-24 14:44:10 +01:00
|
|
|
+ local d='acltestdir_'
|
|
|
|
+ mkdir $d || framework_failure_
|
|
|
|
+ local f=0
|
|
|
|
+
|
|
|
|
+ setfacl -d -m user::r-x $d \
|
|
|
|
+ && setfacl -d -m user::rwx $d \
|
|
|
|
+ || f=1
|
|
|
|
+ rm -rf $d || framework_failure_
|
|
|
|
+ test $f = 0 \
|
2014-02-24 15:21:36 +01:00
|
|
|
+ || skip_ "The current file system does not support ACLs"
|
2014-01-24 14:44:10 +01:00
|
|
|
}
|
|
|
|
|
2014-02-24 15:21:36 +01:00
|
|
|
# Require a controlling input 'terminal'.
|