Added weeding of "sending incremental file list" line to filter_outfile().
[rsync/rsync.git] / testsuite / chmod-option.test
CommitLineData
45d41d08
WD
1#! /bin/sh
2
3# Copyright (C) 2002 by Martin Pool <mbp@samba.org>
4
5# This program is distributable under the terms of the GNU GPL (see
6# COPYING).
7
8# Test that the --chmod option functions correctly.
9
10. $srcdir/testsuite/rsync.fns
11
45d41d08
WD
12# Build some files
13
14fromdir="$scratchdir/from"
15todir="$scratchdir/to"
16checkdir="$scratchdir/check"
17
18mkdir "$fromdir"
19name1="$fromdir/name1"
20name2="$fromdir/name2"
21dir1="$fromdir/dir1"
22dir2="$fromdir/dir2"
23echo "This is the file" > "$name1"
24echo "This is the other file" > "$name2"
25mkdir "$dir1" "$dir2"
26
27chmod 4700 "$name1" || test_skipped "Can't chmod"
28chmod 700 "$dir1"
29chmod 770 "$dir2"
30
31# Copy the files we've created over to another directory
32checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir"
33
34# And then manually make the changes which should occur
35umask 002
36chmod ug-s,a+rX "$checkdir"/*
37chmod +w "$checkdir" "$checkdir"/dir*
38
39checkit "$RSYNC -avv --chmod ug-s,a+rX,D+w \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
40
0480a946 41rm -r "$fromdir" "$checkdir" "$todir"
7ea6ea98 42makepath "$todir" "$fromdir/foo"
0480a946
WD
43touch "$fromdir/bar"
44
45checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir"
71cb9df3 46chmod o+x "$fromdir"/bar
0480a946 47
71cb9df3 48checkit "$RSYNC -avv --chmod=Fo-x \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
0480a946
WD
49
50# Tickle a bug in rsync 2.6.8: if you push a new directory with --perms off to
51# a daemon with an incoming chmod, the daemon pretends the directory is a file
52# for the purposes of the second application of the incoming chmod.
53
54build_rsyncd_conf
55cat >>"$scratchdir/test-rsyncd.conf" <<EOF
56[test-incoming-chmod]
57 path = $todir
58 read only = no
71cb9df3 59 incoming chmod = Fo-x
0480a946
WD
60EOF
61
62RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
63export RSYNC_CONNECT_PROG
64
65rm -r "$todir"
66makepath "$todir"
67
eefe189e 68checkit "$RSYNC -avv --no-perms \"$fromdir/\" localhost::test-incoming-chmod/" "$checkdir" "$todir"
0480a946 69
45d41d08
WD
70# The script would have aborted on error, so getting here means we've won.
71exit 0