2 # Test both cp and mv for their behavior with -if and -fi
3 # The standards (POSIX and SuS) dictate annoyingly inconsistent behavior.
5 # Copyright (C) 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 if test "$VERBOSE" = yes; then
28 . $srcdir/../envvar-check
30 # Make sure we get English translations.
31 . $srcdir/../lang-default
33 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
37 trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
38 trap 'exit $?' 1 2 13 15
41 mkdir $tmp || framework_failure=1
42 cd $tmp || framework_failure=1
44 for i in a b c d e f g h; do
45 echo $i > $i || framework_failure=1
47 chmod 0 b d f h || framework_failure=1
48 echo y > y || framework_failure=1
50 if test $framework_failure = 1; then
51 echo 'failure in testing framework'
57 mv -fi c d < y >/dev/null 2>&1 || fail=1
59 # Before 4.0s, this would not prompt.
60 cp -if e f < y > out 2>&1 || fail=1
62 # Make sure out contains the prompt.
64 "cp: try to overwrite \`f', overriding mode 0000 (---------)?"*) ;;
72 cp -fi g h < y > out 2>&1 || fail=1