]>
gitweb.michael.orlitzky.com - apply-default-acl.git/blob - run-tests.sh
68ae769104826e0e9c759900e116d7d8765e7b32
4 BIN
=.
/src
/apply
-default-acl
6 # The directory where we'll do all the ACL manipulation.
10 # Remove any ACLs on our test directory and remove its contents.
11 setfacl
--remove-all --recursive "${TESTDIR}"
12 chmod 755 "${TESTDIR}"
17 if [[ "${ACTUAL}" == "${EXPECTED}" ]]; then
18 echo "Success (#${TESTNUM})"
21 echo "Failure (#${TESTNUM})"
22 echo 'Expected result:'
23 echo '================'
25 echo '================'
27 echo '================'
29 echo '================'
34 # Start by removing and recreating the 'acl' directory.
39 # When using a minimal ACL, the default user, group, and other
40 # permissions should all be propagated to the mode bits.
42 TARGET
="${TESTDIR}"/foo
43 setfacl
-d -m user
::r
-- "${TESTDIR}"
44 setfacl
-d -m group
::r
-- "${TESTDIR}"
45 setfacl
-d -m other
::r
-- "${TESTDIR}"
58 ACTUAL
=`getfacl --omit-header "${TARGET}"`
61 # Do the same thing as the last test, except with an extended ACL.
63 setfacl
-d -m user
::r
-- "${TESTDIR}"
64 setfacl
-d -m group
::r
-- "${TESTDIR}"
65 setfacl
-d -m other
::r
-- "${TESTDIR}"
66 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
81 ACTUAL
=`getfacl --omit-header "${TARGET}"`
84 # A file shared by a group, should still be group-writable
89 setfacl
-d -m group
:mail:rwx
"${TESTDIR}"
95 group:mail:rwx #effective:rw-
101 ACTUAL
=`getfacl --omit-header "${TARGET}"`
104 # Same test as before except with a directory.
106 setfacl
-d -m group
:mail:rwx
"${TESTDIR}"
108 chmod 755 "${TARGET}"
119 default:group:mail:rwx
126 ACTUAL
=`getfacl --omit-header "${TARGET}"`
130 # With no default, things are left alone.
133 chmod 744 "${TARGET}"
145 ACTUAL
=`getfacl --omit-header "${TARGET}"`
150 # Since the default ACL will grant r-x to group/other, they will wind
154 chmod 744 "${TARGET}"
155 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
169 ACTUAL
=`getfacl --omit-header "${TARGET}"`
173 # Some named entries can be granted execute permissions as the result
177 chmod 744 "${TARGET}"
178 setfacl
-m user
:news
:rw
"${TARGET}"
179 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
180 setfacl
-d -m user
:news
:rwx
"${TESTDIR}"
195 ACTUAL
=`getfacl --omit-header "${TARGET}"`
199 # We should not retain any entries that aren't in the default.
202 chmod 644 "${TARGET}"
203 setfacl
-m user
:news
:rw
"${TARGET}"
204 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
210 user:mail:rwx #effective:rw-
218 ACTUAL
=`getfacl --omit-header "${TARGET}"`
222 # A slightly modified test #1 to make sure it works right.
224 TARGET
="${TESTDIR}"/foo
226 chmod 777 "${TARGET}"
227 setfacl
-d -m user
::r
-- "${TESTDIR}"
238 ACTUAL
=`getfacl --omit-header "${TARGET}"`
242 # If the default ACL mask denies execute, we should respect that
243 # regardless of the existing execute permissions.
245 TARGET
="${TESTDIR}"/foo
247 chmod 777 "${TARGET}"
248 setfacl
-m user
:mail:rwx
"${TESTDIR}"
249 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
250 setfacl
-d -m mask
::rw
- "${TESTDIR}"
255 user:mail:rwx #effective:rw-
256 group::r-x #effective:r--
263 ACTUAL
=`getfacl --omit-header "${TARGET}"`
268 # The --recursive mode should work normally if the argument is a
269 # normal file. See Test #1.
271 TARGET
="${TESTDIR}"/foo
272 setfacl
-d -m user
::r
-- "${TESTDIR}"
273 setfacl
-d -m group
::r
-- "${TESTDIR}"
274 setfacl
-d -m other
::r
-- "${TESTDIR}"
276 chmod 777 "${TARGET}"
277 $BIN --recursive "${TARGET}"
287 ACTUAL
=`getfacl --omit-header "${TARGET}"`
291 # The --recursive mode should work recursively.
293 TARGET
="${TESTDIR}"/foo
295 touch "${TARGET}"/baz
296 mkdir -p "${TARGET}"/bar
297 touch "${TARGET}"/bar
/quux
298 setfacl
-d -m user
::rwx
"${TESTDIR}"
299 setfacl
-d -m group
::r
-- "${TESTDIR}"
300 setfacl
-d -m other
::r
-- "${TESTDIR}"
301 chmod -R 777 "${TARGET}"
302 $BIN --recursive "${TARGET}"
312 ACTUAL
=`getfacl --omit-header "${TARGET}"/bar/quux`
316 # The --recursive mode should work recursively. This time
317 # check a directory, and pass the short command-line flag.
319 TARGET
="${TESTDIR}"/foo
321 touch "${TARGET}"/baz
322 mkdir -p "${TARGET}"/bar
323 touch "${TARGET}"/bar
/quux
324 setfacl
-d -m user
::rwx
"${TESTDIR}"
325 setfacl
-d -m group
::r
-- "${TESTDIR}"
326 setfacl
-d -m other
::r
-- "${TESTDIR}"
327 chmod -R 777 "${TARGET}"
340 ACTUAL
=`getfacl --omit-header "${TARGET}"/bar`
344 # Test double application on a directory.
347 TARGET
="${TESTDIR}"/baz
349 chmod 644 "${TARGET}"
350 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
362 default:user:mail:rwx
369 ACTUAL
=`getfacl --omit-header "${TARGET}"`
373 # Same as test #14, with 755 initial perms.
376 TARGET
="${TESTDIR}"/baz
378 chmod 755 "${TARGET}"
379 setfacl
-d -m user
:mail:rwx
"${TESTDIR}"
391 default:user:mail:rwx
398 ACTUAL
=`getfacl --omit-header "${TARGET}"`