blob: cdf408969697c1761f1f292c34761af947a7ea72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#! /bin/sh
# Originally by Vladimír Michl <Vladimir.Michl@hlubocky.del.cz>
. $srcdir/testsuite/rsync.fns
test_symlink() {
is_a_link "$1" || test_fail "File $1 is not a symlink"
};
test_regular() {
if [ ! -f "$1" ]; then
test_fail "File $1 is not regular file or not exists";
fi;
};
test_copy() {
test_symlink dest/links/file1
test_symlink dest/links/file2
test_regular dest/links/unsafefile
}
cd "$TMP"
mkdir from
mkdir "from/safe"
mkdir "from/unsafe"
mkdir "from/safe/files"
mkdir "from/safe/links"
touch "from/safe/files/file1"
touch "from/safe/files/file2"
touch "from/unsafe/unsafefile"
ln -s ../files/file1 "from/safe/links/"
ln -s ../files/file2 "from/safe/links/"
ln -s ../../unsafe/unsafefile "from/safe/links/"
#next rsync copy correctly
set -x
echo "rsync with relative path";
rsync -avv --copy-unsafe-links from/safe/ to
test_copy;
rm -rf to
#next rsync copy uncorectly - links are copied as files not as links
echo "rsync with relative2 path";
(cd from; rsync -avv --copy-unsafe-links safe/ ../to)
test_copy;
rm -rf to
#next rsync copy uncorectly - all links are copied
echo "rsync with absolute path";
rsync -avv --copy-unsafe-links `pwd`/from/safe/ to
test_copy;
|