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 # Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 if test "$VERBOSE" = yes; then
30 . $srcdir/../envvar-check
31 . $srcdir/../lang-default
32 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
36 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
37 trap '(exit $?); exit' 1 2 13 15
40 mkdir $tmp || framework_failure=1
41 cd $tmp || framework_failure=1
43 if test $framework_failure = 1; then
44 echo "$0: failure in testing framework" 1>&2
52 # cp may not fail in this case.
54 rm -fr a d; touch a; mkdir d
55 $i a a d/ 2> out || fail=1
56 rm -fr a d; touch a; mkdir d
57 $i ./a a d/ 2>> out || fail=1
59 # cp succeeds with --backup=numbered.
60 rm -fr a d; touch a; mkdir d
61 $i --backup=numbered a a d/ 2>> out || fail=1
63 # But not with plain `--backup'
64 rm -fr a d; touch a; mkdir d
65 $i --backup a a d/ 2>> out && fail=1
67 $i: warning: source file \`a' specified more than once
68 $i: warning: source file \`a' specified more than once
69 $i: will not overwrite just-created \`d/a' with \`a'
72 test $fail = 1 && diff out exp 2> /dev/null
76 # But mv *does* fail in this case (it has to).
78 rm -fr a d; touch a; mkdir d
79 $i a a d/ 2> out && fail=1
80 rm -fr a d; touch a; mkdir d
81 $i ./a a d/ 2>> out && fail=1
83 $i: cannot stat \`a': No such file or directory
84 $i: cannot stat \`a': No such file or directory
87 test $fail = 1 && diff out exp 2> /dev/null
90 (exit $fail); exit $fail