SYSENTER/SYSCALL support
[minix.git] / commands / tar / test / test-acl.sh
blob818607dcd13c602bed85ddde3a8ad434de993326
1 #!/bin/sh
2 # Copyright (c) 2007 Tim Kientzle
3 # All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
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
28 echo "ACL handling"
29 # Basic test configuration
30 TESTDIR=/mnt/da0/acl-test
31 . `dirname $0`/config.sh
33 # Create some files with ACLs
34 mkdir original
35 cd original
36 touch a
37 chmod 664 a
38 setfacl -m user:bin:rw- -m group:78:r-x a \
39 || echo XXX failed to set access ACL on a XXX
40 mkdir d
41 chmod 775 d
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
46 cd ..
48 # Copy the dir with -p
49 echo " -p preserves ACLs"
50 mkdir copy
51 (cd original && ${BSDTAR} -cf - .) | (cd copy; ${BSDTAR} -xpf -)
53 # Verify the ACLs
54 cd copy
55 if [ "user::rw- user:bin:rw- group::rw- group:78:r-x mask::rwx other::r--" \
56 = "`echo \`getfacl -q a\``" ]; then
57 # It matches!!
58 else
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
64 # It matches!!
65 else
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
72 # It matches!!
73 else
74 echo XXX d has wrong ACL XXX `getfacl -q -d d`