2 # Ensure that cp merely warns when a non-directory source file is
3 # listed on the command line more than once. fileutils-4.1.1
4 # made this fail: cp a a d/
5 # Ensure that mv fails with a similar command.
7 if test "$VERBOSE" = yes; then
13 .
$srcdir/..
/envvar-check
14 .
$srcdir/..
/lang-default
15 PRIV_CHECK_ARG
=require-non-root .
$srcdir/..
/priv-check
19 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
20 trap '(exit $?); exit' 1 2 13 15
23 mkdir
$tmp || framework_failure
=1
24 cd $tmp || framework_failure
=1
26 if test $framework_failure = 1; then
27 echo "$0: failure in testing framework" 1>&2
35 # cp may not fail in this case.
37 rm -fr a d
; touch a
; mkdir d
38 $i a a d
/ 2> out || fail
=1
39 rm -fr a d
; touch a
; mkdir d
40 $i .
/a a d
/ 2>> out || fail
=1
42 # cp succeeds with --backup=numbered.
43 rm -fr a d
; touch a
; mkdir d
44 $i --backup=numbered a a d
/ 2>> out || fail
=1
46 # But not with plain `--backup'
47 rm -fr a d
; touch a
; mkdir d
48 $i --backup a a d
/ 2>> out
&& fail
=1
50 $i: warning: source file \`a' specified more than once
51 $i: warning: source file \`a' specified more than once
52 $i: will not overwrite just-created \`d/a' with \`a'
55 test $fail = 1 && diff out exp
2> /dev
/null
59 # But mv *does* fail in this case (it has to).
61 rm -fr a d
; touch a
; mkdir d
62 $i a a d
/ 2> out
&& fail
=1
63 rm -fr a d
; touch a
; mkdir d
64 $i .
/a a d
/ 2>> out
&& fail
=1
66 $i: cannot stat \`a': No such file or directory
67 $i: cannot stat \`a': No such file or directory
70 test $fail = 1 && diff out exp
2> /dev
/null