2 # Ensure that moving hard-linked arguments onto existing destinations works.
3 # Likewise when using cp --preserve=link.
5 if test "$VERBOSE" = yes; then
11 . $srcdir/../envvar-check
12 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
15 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
16 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
17 trap '(exit $?); exit $?' 1 2 13 15
20 mkdir -p $tmp || framework_failure=1
21 cd $tmp || framework_failure=1
22 mkdir dst || framework_failure=1
23 (cd dst && touch a b c) || framework_failure=1
24 touch a || framework_failure=1
25 ln a b || framework_failure=1
26 ln a c || framework_failure=1
28 if test $framework_failure = 1; then
29 echo "$0: failure in testing framework" 1>&2
35 # ======================================
36 cp --preserve=link a b c dst || fail=1
37 # The source files must remain.
43 # Three destination files must exist.
48 # The three i-node numbers must be the same.
49 ia=`ls -i a|sed 's/ a//'`
50 ib=`ls -i b|sed 's/ b//'`
51 ic=`ls -i c|sed 's/ c//'`
52 test $ia = $ib || fail=1
53 test $ia = $ic || fail=1
57 (cd dst && touch a b c)
59 # ======================================
60 mv a b c dst || fail=1
62 # The source files must be gone.
68 # Three destination files must exist.
73 # The three i-node numbers must be the same.
74 ia=`ls -i a|sed 's/ a//'`
75 ib=`ls -i b|sed 's/ b//'`
76 ic=`ls -i c|sed 's/ c//'`
77 test $ia = $ib || fail=1
78 test $ia = $ic || fail=1
80 (exit $fail); exit $fail