From 25170852d7947c6ace4ddf5fe31e65c84391ae44 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 22 Nov 2001 13:03:50 +0000 Subject: *** empty log message *** --- tests/mv/dup-source | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 tests/mv/dup-source (limited to 'tests/mv/dup-source') diff --git a/tests/mv/dup-source b/tests/mv/dup-source new file mode 100755 index 000000000..58dba1495 --- /dev/null +++ b/tests/mv/dup-source @@ -0,0 +1,63 @@ +#!/bin/sh +# Ensure that cp/mv merely warn when a non-directory source file is +# listed on the command line more than once. fileutils-4.1.1 +# made this fail: cp a a d/ + +if test "$VERBOSE" = yes; then + set -x + cp --version + mv --version +fi + +. $srcdir/../envvar-check +. $srcdir/../lang-default +PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check + +pwd=`pwd` +tmp=dup-src.$$ +trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0 +trap '(exit $?); exit' 1 2 13 15 + +framework_failure=0 +mkdir $tmp || framework_failure=1 +cd $tmp || framework_failure=1 + +if test $framework_failure = 1; then + echo '$0: failure in testing framework' 1>&2 + (exit 1); exit +fi + +fail=0 + +for i in cp; do + + # cp may not fail in this case. + + rm -fr a d; touch a; mkdir d + $i a a d/ 2> out || fail=1 + rm -fr a d; touch a; mkdir d + $i ./a a d/ 2>> out || fail=1 + cat < exp +$i: warning: source file \`a' specified more than once +$i: warning: source file \`a' specified more than once +EOF + cmp out exp || fail=1 + test $fail = 1 && diff out exp 2> /dev/null +done + +for i in mv; do + # But mv *must* fail in this case. + + rm -fr a d; touch a; mkdir d + $i a a d/ 2> out && fail=1 + rm -fr a d; touch a; mkdir d + $i ./a a d/ 2>> out && fail=1 + cat < exp +$i: cannot stat \`a': No such file or directory +$i: cannot stat \`a': No such file or directory +EOF + cmp out exp || fail=1 + test $fail = 1 && diff out exp 2> /dev/null +done + +(exit $fail); exit -- cgit v1.2.3-54-g00ecf