2 # Confirm that copying a directory into itself gets a proper diagnostic.
3 # In 4.0.35 and earlier, `mkdir dir && cp -R dir dir' would produce this:
4 # cp: won't create hard link `dir/dir/dir' to directory `'
6 # cp: can't copy a directory `dir' into itself `dir/dir'
8 if test "$VERBOSE" = yes; then
13 . $srcdir/../envvar-check
14 . $srcdir/../lang-default
18 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
19 trap '(exit $?); exit' 1 2 13 15
22 mkdir $tmp || framework_failure=1
23 cd $tmp || framework_failure=1
25 mkdir dir || framework_failure=1
27 if test $framework_failure = 1; then
28 echo 'failure in testing framework' 1>&2
34 # This command should exit nonzero.
35 cp -R dir dir 2> out && fail=1
38 cp: cannot copy a directory, `dir', into itself, `dir/dir'
43 test $fail = 1 && diff out exp 2> /dev/null