Make explicit that (in|ex)clude patterns are for relative
[rsync/rsync.git] / testsuite / duplicates.test
CommitLineData
766526c7
MP
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 rsync handling of duplicate filenames.
9
10# It's quite possible that the user might specify the same source file
11# more than once on the command line, perhaps through shell variables
12# or wildcard expansions. It might cause problems for rsync if the
13# same name occurred more than once in the file list, because we might
14# be trying to update the first copy and generate checksums for the
15# second copy at the same time. See clean_flist() for the implementation.
16
17# We don't need to worry about hardlinks or symlinks. Because we
18# always rename-and-replace the new copy, they can't affect us.
19
20# This test is not great, because it is a timing-dependent bug.
21
22. $srcdir/testsuite/rsync.fns
23
79c9d8a1 24test_skipped "Known minor bug in this code"
b31427cd 25
766526c7
MP
26set -x
27
28# Build some hardlinks
29
30fromdir="$scratchdir/from"
31todir="$scratchdir/to"
32
766526c7
MP
33mkdir "$fromdir"
34name1="$fromdir/name1"
1623ba68 35name2="$fromdir/name2"
766526c7
MP
36echo "This is the file" > "$name1"
37ln -s "$name1" "$name2" || fail "can't create symlink"
38
1623ba68
MP
39outfile="$scratchdir/rsync.out"
40
06464f55 41checkit "$RSYNC -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
1623ba68
MP
42 | tee "$outfile"
43
44# Make sure each file was only copied once...
45if [ `grep -c '^name1$' "$outfile"` != 1 ]
46then
49374592 47 test_xfail "name1 was not copied exactly once"
1623ba68
MP
48fi
49if [ `grep -c '^name2$' "$outfile"` != 1 ]
50then
49374592 51 test_xfail "name2 was not copied exactly once"
1623ba68 52fi
766526c7
MP
53
54exit 0
55# last [] may have failed but if we get here then we've won
56