A daemon needs to set dry_run with --only-write-batch.
[rsync.git] / testsuite / acls.test
blobfe827ba7c493785aede1140b0f7bef7ed2f6dbcd
1 #! /bin/sh
3 # This program is distributable under the terms of the GNU GPL (see
4 # COPYING).
6 # Test that rsync handles basic ACL preservation.
8 . $srcdir/testsuite/rsync.fns
10 $RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
12 makepath "$fromdir/foo"
13 echo something >"$fromdir/file1"
14 echo else >"$fromdir/file2"
16 files='foo file1 file2'
18 case "$setfacl_nodef" in
19 true)
20 if ! chmod --help 2>&1 | fgrep +a >/dev/null; then
21 test_skipped "I don't know how to use setfacl or chmod for ACLs"
23 chmod +a "root allow read,write,execute" "$fromdir/foo" || test_skipped "Your filesystem has ACLs disabled"
24 chmod +a "root allow read,execute" "$fromdir/file1"
25 chmod +a "admin allow read" "$fromdir/file1"
26 chmod +a "daemon allow read,write" "$fromdir/file1"
27 chmod +a "root allow read,execute" "$fromdir/file2"
29 see_acls() {
30 ls -le "${@}"
34 setfacl -m u:0:7 "$fromdir/foo" || test_skipped "Your filesystem has ACLs disabled"
35 setfacl -m g:1:5 "$fromdir/foo"
36 setfacl -m g:2:1 "$fromdir/foo"
37 setfacl -m g:0:7 "$fromdir/foo"
38 setfacl -m u:2:1 "$fromdir/foo"
39 setfacl -m u:1:5 "$fromdir/foo"
41 setfacl -m u:0:5 "$fromdir/file1"
42 setfacl -m g:0:4 "$fromdir/file1"
43 setfacl -m u:1:6 "$fromdir/file1"
45 setfacl -m u:0:5 "$fromdir/file2"
47 see_acls() {
48 getfacl "${@}"
51 esac
53 cd "$fromdir"
54 $RSYNC -avvA $files "$todir/"
56 see_acls $files >"$scratchdir/acls.txt"
58 cd "$todir"
59 see_acls $files | diff $diffopt "$scratchdir/acls.txt" -
61 # The script would have aborted on error, so getting here means we've won.
62 exit 0