File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / testsuite / unsafe-links.test
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 3 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>