3 # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
5 # This program is distributable under the terms of the GNU GPL (see
8 # Test that the --chmod option functions correctly.
10 . $srcdir/testsuite/rsync.fns
14 fromdir="$scratchdir/from"
15 todir="$scratchdir/to"
16 checkdir="$scratchdir/check"
19 name1="$fromdir/name1"
20 name2="$fromdir/name2"
23 echo "This is the file" > "$name1"
24 echo "This is the other file" > "$name2"
27 chmod 4700 "$name1" || test_skipped "Can't chmod"
31 # Copy the files we've created over to another directory
32 checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir"
34 # And then manually make the changes which should occur
36 chmod ug-s,a+rX "$checkdir"/*
37 chmod +w "$checkdir" "$checkdir"/dir*
39 checkit "$RSYNC -avv --chmod ug-s,a+rX,D+w \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
41 rm -r "$fromdir" "$checkdir" "$todir"
43 makepath "$fromdir/foo"
46 checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir"
47 chmod +t "$checkdir"/bar
49 checkit "$RSYNC -avv --chmod=F+t \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
51 # Tickle a bug in rsync 2.6.8: if you push a new directory with --perms off to
52 # a daemon with an incoming chmod, the daemon pretends the directory is a file
53 # for the purposes of the second application of the incoming chmod.
56 cat >>"$scratchdir/test-rsyncd.conf" <<EOF
63 RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
64 export RSYNC_CONNECT_PROG
69 checkit "$RSYNC -rtvv \"$fromdir/\" localhost::test-incoming-chmod/" "$checkdir" "$todir"
71 # The script would have aborted on error, so getting here means we've won.