summaryrefslogtreecommitdiff
path: root/testsuite/unsafe-links.test
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-04-05 06:57:47 +0000
committerMartin Pool <mbp@samba.org>2002-04-05 06:57:47 +0000
commit2f1faea89b8dcf5998fff55c2fe7f4116f4006fd (patch)
tree50c6ddbc967bfd0047811500eec0ddd570e9a1ed /testsuite/unsafe-links.test
parent3d90ec146fab1637a864e9473288a796a7b70c72 (diff)
downloadrsync-2f1faea89b8dcf5998fff55c2fe7f4116f4006fd.tar.gz
Test case for --copy-unsafe-links, contributed by Vladimír Michl,
converted to the test suite. Thankyou! It fails at the moment; I don't know if that's a test bug or an rsync bug.
Diffstat (limited to 'testsuite/unsafe-links.test')
-rw-r--r--testsuite/unsafe-links.test58
1 files changed, 58 insertions, 0 deletions
diff --git a/testsuite/unsafe-links.test b/testsuite/unsafe-links.test
new file mode 100644
index 00000000..cdf40896
--- /dev/null
+++ b/testsuite/unsafe-links.test
@@ -0,0 +1,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;
+