#!/bin/sh
-# Make sure `mv file unwritable-file' prompts the user.
+# Make sure that `mv file unwritable-file' prompts the user
+# and that `mv -f file unwritable-file' doesn't.
if test "$VERBOSE" = yes; then
set -x
framework_failure=0
mkdir $tmp || framework_failure=1
cd $tmp || framework_failure=1
-touch f g || framework_failure=1
-chmod 0 g || framework_failure=1
+touch f g h i || framework_failure=1
+chmod 0 g i || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
ls /dev/stdin >/dev/null 2>&1 \
|| { (exit 77); exit; }
+
mv f g < /dev/stdin > out 2>&1 & pid=$!
sleep 1
kill $pid
*) fail=1 ;;
esac
+mv -f h i > out 2>&1 || fail=1
+test -f i || fail=1
+test -f h && fail=1
+
+# Make sure there was no prompt.
+case "`cat out`" in
+ '') ;;
+ *) fail=1 ;;
+esac
+
(exit $fail); exit