From 1760ade090cbf8c854c1033399d51ff4fdde3ae0 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 19 Nov 2008 19:16:34 +0100 Subject: [PATCH] tests: add a test of cp --preserve=links * tests/cp/link-preserve: Add a case and comments. --- tests/cp/link-preserve | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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/.*,,'` -- 2.47.3