Do some simple tests with various read-only and set[ug]id files.
[rsync/rsync.git] / testsuite / chmod-temp-dir.test
... / ...
CommitLineData
1#! /bin/sh
2
3# Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
4
5# This program is distributable under the terms of the GNU GPL see
6# COPYING).
7
8# Test that various read-only and set[ug]id permissions work properly,
9# even when using a --temp-dir option (which we try to point at a
10# different filesystem than the destination dir).
11
12. "$suitedir/rsync.fns"
13
14set -x
15
16hands_setup
17
18tmpdir2=/tmp
19sdev=`$TOOLDIR/getfsdev $scratchdir`
20tdev=`$TOOLDIR/getfsdev $tmpdir2`
21if [ x$sdev = x$tdev ]; then
22 tmpdir2=/var/tmp
23 tdev=`$TOOLDIR/getfsdev $tmpdir2`
24 [ x$sdev = x$tdev ] && test_skipped "Can't find a tmp dir on a different file system"
25fi
26
27chmod 440 "$fromdir/text"
28chmod 500 "$fromdir/dir/text"
29chmod 6450 "$fromdir/dir/subdir/foobar.baz"
30chmod 2670 "$fromdir/dir/subdir/subsubdir/etc-ltr-list"
31
32# First a normal copy using --temp-dir.
33runtest "normal copy" 'checkit "$RSYNC -avv --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
34
35# Then we update all the files using --temp-dir.
36runtest "update copy" 'checkit "$RSYNC -avvI --no-whole-file --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
37
38# The script would have aborted on error, so getting here means we've won.
39exit 0