Temporarily skip this test as it is taking too long on the
[rsync/rsync.git] / testsuite / default-acls.test
CommitLineData
1c3344a1
WD
1#! /bin/sh
2
3# This program is distributable under the terms of the GNU GPL (see
4# COPYING).
5
6# Test that rsync obeys default ACLs. -- Matt McCutchen
7
8. $srcdir/testsuite/rsync.fns
9
10$RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
11
12case "$RSYNC" in
13*protocol=29*) test_skipped "ACLs require protocol 30" ;;
14esac
15
16case "$setfacl_nodef" in
17true) test_skipped "I don't know how to use your setfacl command" ;;
18*-k*) opts='-dm u::7,g::5,o:5' ;;
19*) opts='-m d:u::7,d:g::5,d:o:5' ;;
20esac
21setfacl $opts "$scratchdir" || test_skipped "Your filesystem has ACLs disabled"
22
3060ca8d
WD
23test_skipped "Skipping temporarily due to compile-farm timeouts"
24
1c3344a1
WD
25# Call as: testit <dirname> <default-acl> <file-expected> <program-expected>
26testit() {
27 todir="$scratchdir/$1"
28 mkdir "$todir"
29 $setfacl_nodef "$todir"
30 if [ "$2" ]; then
31 case "$setfacl_nodef" in
32 *-k*) opts="-dm $2" ;;
33 *) opts="-m `echo $2 | sed 's/\([ugom]:\)/d:\1/g'`"
34 esac
35 setfacl $opts "$todir"
36 fi
37 # Make sure we obey ACLs when creating a directory to hold multiple transferred files,
38 # even though the directory itself is outside the transfer
39 $RSYNC -rvv "$scratchdir/dir" "$scratchdir/file" "$scratchdir/program" "$todir/to/"
40 check_perms "$todir/to" $4 "Target $1"
41 check_perms "$todir/to/dir" $4 "Target $1"
42 check_perms "$todir/to/file" $3 "Target $1"
43 check_perms "$todir/to/program" $4 "Target $1"
44 # Make sure get_local_name doesn't mess us up when transferring only one file
45 $RSYNC -rvv "$scratchdir/file" "$todir/to/anotherfile"
46 check_perms "$todir/to/anotherfile" $3 "Target $1"
47 # Make sure we obey default ACLs when not transferring a regular file
48 $RSYNC -rvv "$scratchdir/dir/" "$todir/to/anotherdir/"
49 check_perms "$todir/to/anotherdir" $4 "Target $1"
50}
51
52mkdir "$scratchdir/dir"
53echo "File!" >"$scratchdir/file"
54echo "#!/bin/sh" >"$scratchdir/program"
55chmod 777 "$scratchdir/dir"
56chmod 666 "$scratchdir/file"
57chmod 777 "$scratchdir/program"
58
59# Test some target directories
60umask 0077
61testit da777 u::7,g::7,o:7 rw-rw-rw- rwxrwxrwx
62testit da775 u::7,g::7,o:5 rw-rw-r-- rwxrwxr-x
63testit da750 u::7,g::5,o:0 rw-r----- rwxr-x---
64testit da770mask u::7,u:0:7,g::0,m:7,o:0 rw-rw---- rwxrwx---
65testit noda1 '' rw------- rwx------
66umask 0000
67testit noda2 '' rw-rw-rw- rwxrwxrwx
68umask 0022
69testit noda3 '' rw-r--r-- rwxr-xr-x
70
71# Hooray
72exit 0