2 # ensure that `cp -d' preserves hard-links between command line arguments
3 # ensure that --preserve=links works with -RH and -RL
5 if test "$VERBOSE" = yes; then
10 . $srcdir/../envvar-check
11 . $srcdir/../lang-default
15 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
16 trap '(exit $?); exit' 1 2 13 15
19 mkdir $tmp || framework_failure=1
20 cd $tmp || framework_failure=1
21 touch a || framework_failure=1
22 ln a b || framework_failure=1
23 mkdir c || framework_failure=1
24 cp -d a b c || framework_failure=1
25 test -f c/a || framework_failure=1
26 test -f c/b || framework_failure=1
28 if test $framework_failure = 1; then
29 echo 'failure in testing framework' 1>&2
35 a_inode=`ls -i c/a|sed 's,c/.*,,'`
36 b_inode=`ls -i c/b|sed 's,c/.*,,'`
37 test "$a_inode" = "$b_inode" || fail=1
38 # --------------------------------------
44 cp --preserve=links -R -H a b c
45 a_inode=`ls -i c/a|sed 's,c/.*,,'`
46 b_inode=`ls -i c/b|sed 's,c/.*,,'`
47 test "$a_inode" = "$b_inode" || fail=1
48 # --------------------------------------
52 (cd d; touch a; ln -s a b)
53 cp --preserve=links -R -L d c
54 a_inode=`ls -i c/a|sed 's,c/.*,,'`
55 b_inode=`ls -i c/b|sed 's,c/.*,,'`
56 test "$a_inode" = "$b_inode" || fail=1
57 # --------------------------------------
59 # Ensure that --no-preserve=links works.
62 (cd d; touch a; ln a b)
63 cp -dR --no-preserve=links d c
64 a_inode=`ls -i c/a|sed 's,c/.*,,'`
65 b_inode=`ls -i c/b|sed 's,c/.*,,'`
66 test "$a_inode" = "$b_inode" && fail=1
67 # --------------------------------------
69 # Ensure that -d still preserves hard links.
74 a_inode=`ls -i c/a|sed 's,c/.*,,'`
75 b_inode=`ls -i c/b|sed 's,c/.*,,'`
76 test "$a_inode" = "$b_inode" || fail=1
77 # --------------------------------------
79 # Ensure that --no-preserve=mode works
83 cp -a --no-preserve=mode a b
84 set _ `ls -l b`; shift; mode=$1
85 test "$mode" = "-rwx------" || fail=1
87 # --------------------------------------