2 # Copyright (c) 2007 Tim Kientzle
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 # IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 # $FreeBSD: src/usr.bin/tar/test/test-acl.sh,v 1.1 2007/03/11 10:36:42 kientzle Exp $
27 # Exercise copying of ACLs
29 # Basic test configuration
30 TESTDIR
=/mnt
/da
0/acl-test
31 .
`dirname $0`/config.sh
33 # Create some files with ACLs
38 setfacl
-m user
:bin
:rw-
-m group
:78:r-x a \
39 ||
echo XXX failed to
set access ACL on a XXX
42 setfacl
-m user
:daemon
:rw-
-m group
:78:r-x d \
43 ||
echo XXX failed to
set access ACL on d XXX
44 setfacl
-d -m user
::rw-
-m group
::rw-
-m other
::rw-
-m group
:79:r-- d \
45 ||
echo XXX failed to
set default ACL on d XXX
48 # Copy the dir with -p
49 echo " -p preserves ACLs"
51 (cd original
&& ${BSDTAR} -cf - .
) |
(cd copy
; ${BSDTAR} -xpf -)
55 if [ "user::rw- user:bin:rw- group::rw- group:78:r-x mask::rwx other::r--" \
56 = "`echo \`getfacl -q a\``" ]; then
59 echo XXX a has wrong ACL XXX
`getfacl -q a`
62 if [ "user::rwx user:daemon:rw- group::rwx group:78:r-x mask::rwx other::r-x" \
63 = "`echo \`getfacl -q d\``" ]; then
66 echo XXX d has wrong ACL XXX
`getfacl -q d`
70 if [ "user::rw- group::rw- group:79:r-- mask::rw- other::rw-" \
71 = "`echo \`getfacl -q -d d\``" ]; then
74 echo XXX d has wrong ACL XXX
`getfacl -q -d d`