Skip to content

Commit a14ad10

Browse files
peffgitster
authored andcommitted
t1304: improve setfacl prerequisite setup
t1304 first runs setfacl as an experiment to see whether the filesystem supports ACLs, and skips the remaining tests if it does not. However, our setfacl run did not exercise the ACLs very well, and some filesystems may support our initial setfacl, but not the rest of the test. In particular, some versions of ecryptfs will erroneously apply the umask on top of an inherited directory ACL, causing our tests to fail. Let's be more careful and make sure both that we can read back the user ACL we set, and that the inherited ACL is propagated correctly. The latter catches the ecryptfs bug, but may also catch other bugs (e.g., an implementation which does not handle inherited ACLs at all). Since we're making the setup more complex, let's move it into its own test. This will hide the output for us unless the user wants to run "-v" to see it (and we don't need to bother printing anything about setfacl failing; the remaining tests will properly print "skip" due to the missing prerequisite). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac2604c commit a14ad10

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

t/t1304-default-acl.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ umask 077
1414
# We need an arbitrary other user give permission to using ACLs. root
1515
# is a good candidate: exists on all unices, and it has permission
1616
# anyway, so we don't create a security hole running the testsuite.
17-
18-
setfacl_out="$(setfacl -m u:root:rwx . 2>&1)"
19-
setfacl_ret=$?
20-
21-
if test $setfacl_ret != 0
22-
then
23-
say "Unable to use setfacl (output: '$setfacl_out'; return code: '$setfacl_ret')"
24-
else
25-
test_set_prereq SETFACL
26-
fi
17+
test_expect_success 'checking for a working acl setup' '
18+
if setfacl -m d:m:rwx -m u:root:rwx . &&
19+
getfacl . | grep user:root:rwx &&
20+
touch should-have-readable-acl &&
21+
getfacl should-have-readable-acl | egrep "mask::?rw-"
22+
then
23+
test_set_prereq SETFACL
24+
fi
25+
'
2726

2827
if test -z "$LOGNAME"
2928
then

0 commit comments

Comments
 (0)