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 when rsync is running as root and has -a it correctly sets
9 # the ownership of the destination.
11 # We don't know what users will be present on this system, so we just
12 # use random numeric uids and gids.
14 . "$suitedir/rsync.fns"
18 $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync needs xattrs for fake device tests"
19 RSYNC="$RSYNC --fake-super"
21 case "`xattr 2>&1`" in
26 xattr -s 'rsync.%stat' "100644 0,0 $own" "${@}"
33 setfattr -n 'user.rsync.%stat' -v "100644 0,0 $own" "${@}"
40 '') ;; # If "id" failed, try to continue...
42 *) if [ -f /usr/bin/fakeroot ]; then
43 echo "Let's try re-running the script under fakeroot..."
44 exec /usr/bin/fakeroot /bin/sh "$0"
51 # Build some hardlinks
54 name1="$fromdir/name1"
55 name2="$fromdir/name2"
56 echo "This is the file" > "$name1"
57 echo "This is the other file" > "$name2"
59 chown 5000:5002 "$name1" || test_skipped "Can't chown (probably need root)"
60 chown 5001:5003 "$name2" || test_skipped "Can't chown (probably need root)"
63 checkit "$RSYNC -aHvv from/ to/" "$fromdir" "$todir"
65 # The script would have aborted on error, so getting here means we've won.