]> gitweb.michael.orlitzky.com - apply-default-acl.git/blobdiff - run-tests.sh
Add another test.
[apply-default-acl.git] / run-tests.sh
index 4bfd36461bbe3cd944792df67785938046326986..a01d47c1922df9481ecb7213405593b8956776d5 100755 (executable)
@@ -139,8 +139,8 @@ compare
 
 
 
-# Make sure execute permission is removed for group/other after the
-# reapplication.
+# Since the default ACL will grant r-x to group/other, they will wind
+# up with it.
 TESTNUM=6
 touch "${TARGET}"
 chmod 744 "${TARGET}"
@@ -151,9 +151,9 @@ setfacl -d -m user:mail:rwx "${TESTDIR}"
 EXPECTED=$(cat <<EOF
 user::rwx
 user:mail:rwx
-group::r--
+group::r-x
 mask::rwx
-other::r--
+other::r-x
 
 EOF
 )
@@ -162,9 +162,8 @@ ACTUAL=`getfacl --omit-header "${TARGET}"`
 compare
 
 
-# In fact, no existing named entries without execute permissions
-# should be granted execute permissions as the result of
-# reapplication.
+# Some named entries can be granted execute permissions as the result
+# of reapplication.
 TESTNUM=7
 touch "${TARGET}"
 chmod 744 "${TARGET}"
@@ -177,9 +176,32 @@ setfacl -d -m user:news:rwx "${TESTDIR}"
 EXPECTED=$(cat <<EOF
 user::rwx
 user:mail:rwx
-user:news:rw-
-group::r--
+user:news:rwx
+group::r-x
 mask::rwx
+other::r-x
+
+EOF
+)
+
+ACTUAL=`getfacl --omit-header "${TARGET}"`
+compare
+
+
+# We should not retain any entries that aren't in the default.
+TESTNUM=8
+touch "${TARGET}"
+chmod 644 "${TARGET}"
+setfacl -m user:news:rw "${TARGET}"
+setfacl -d -m user:mail:rwx "${TESTDIR}"
+./aclq "${TARGET}"
+
+
+EXPECTED=$(cat <<EOF
+user::rw-
+user:mail:rwx  #effective:rw-
+group::r--
+mask::rw-
 other::r--
 
 EOF
@@ -187,3 +209,23 @@ EOF
 
 ACTUAL=`getfacl --omit-header "${TARGET}"`
 compare
+
+
+# A slightly modified test #1 to make sure it works right.
+TESTNUM=9
+TARGET="${TESTDIR}"/foo
+touch "${TARGET}"
+chmod 777 "${TARGET}"
+setfacl -d -m user::r--  "${TESTDIR}"
+./aclq "${TARGET}"
+
+EXPECTED=$(cat <<EOF
+user::r--
+group::r-x
+other::r-x
+
+EOF
+)
+
+ACTUAL=`getfacl --omit-header "${TARGET}"`
+compare