*** empty log message ***
[coreutils.git] / tests / mv / into-self-2
blob84b02576bde0b52a46e5e35b58af30bbee238c2f
1 #!/bin/sh
2 # Force mv to use the copying code.
3 # Consider the case where SRC and DEST are on different
4 # partitions and DEST is a symlink to SRC.
6 if test "$VERBOSE" = yes; then
7 set -x
8 mv --version
9 fi
11 . $srcdir/setup
13 if test -z "$other_partition_tmpdir"; then
14 exit 77
17 file="$other_partition_tmpdir/file"
18 symlink=symlink
20 framework_failure=0
21 rm -f $file $symlink || framework_failure=1
22 echo whatever > $file || framework_failure=1
23 ln -s $file $symlink || framework_failure=1
25 if test $framework_failure = 1; then
26 echo 'failure in testing framework'
27 exit 1
30 # Make sure we get English translations.
31 LANGUAGE=C
32 export LANGUAGE
33 LC_ALL=C
34 export LC_ALL
35 LANG=C
36 export LANG
38 # This mv command should exit nonzero.
39 mv $symlink $file > out 2>&1 && fail=1
41 # And so should this one.
42 mv $file $symlink >> out 2>&1 && fail=1
44 sed \
45 -e "s,mv:,XXX:," \
46 -e "s,$file,YYY," \
47 -e "s,$symlink,ZZZ," \
48 out > out2
50 cat > exp <<\EOF
51 XXX: `ZZZ' and `YYY' are the same file
52 XXX: `YYY' and `ZZZ' are the same file
53 EOF
56 cmp out2 exp || fail=1
58 rm -fr out out2 exp $file $symlink $other_partition_tmpdir
60 exit $fail