From: Jim Meyering Date: Wed, 19 Nov 2008 18:16:34 +0000 (+0100) Subject: tests: add a test of cp --preserve=links X-Git-Tag: v7.1~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1760ade090cbf8c854c1033399d51ff4fdde3ae0;p=thirdparty%2Fcoreutils.git tests: add a test of cp --preserve=links * tests/cp/link-preserve: Add a case and comments. --- diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve index 309c051217..fbde3ffe72 100755 --- a/tests/cp/link-preserve +++ b/tests/cp/link-preserve @@ -48,9 +48,17 @@ b_inode=`ls -i c/b|sed 's,c/.*,,'` test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- -rm -rf a b c d -mkdir d -(cd d; touch a; ln -s a b) +# Ensure that -L makes cp follow the b->a symlink +# and translates to hard-linked a and b in the destination dir. +rm -rf a b c d; mkdir d; (cd d; touch a; ln -s a b) +cp --preserve=links -R -L d c +a_inode=`ls -i c/a|sed 's,c/.*,,'` +b_inode=`ls -i c/b|sed 's,c/.*,,'` +test "$a_inode" = "$b_inode" || fail=1 +# -------------------------------------- + +# Same as above, but starting with a/b hard linked. +rm -rf a b c d; mkdir d; (cd d; touch a; ln a b) cp --preserve=links -R -L d c a_inode=`ls -i c/a|sed 's,c/.*,,'` b_inode=`ls -i c/b|sed 's,c/.*,,'` @@ -58,9 +66,7 @@ test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- # Ensure that --no-preserve=links works. -rm -rf a b c d -mkdir d -(cd d; touch a; ln a b) +rm -rf a b c d; mkdir d; (cd d; touch a; ln a b) cp -dR --no-preserve=links d c a_inode=`ls -i c/a|sed 's,c/.*,,'` b_inode=`ls -i c/b|sed 's,c/.*,,'`