*** empty log message ***
[coreutils.git] / tests / mv / to-symlink
blob354a10763d7975aa51bf2afc67e010f21047abf9
1 #!/bin/sh
2 # Make sure that the copying code used in an inter-partition
3 # move unlinks a destination symlink before opening it.
5 if test "$VERBOSE" = yes; then
6 set -x
7 mv --version
8 fi
10 . $srcdir/setup
11 . $srcdir/../envvar-check
13 if test -z "$other_partition_tmpdir"; then
14 exit 77
17 rem_file="$other_partition_tmpdir/file"
18 rem_symlink="$other_partition_tmpdir/symlink"
19 file=to-sym-$$
21 fail=0
23 trap 'rm -fr $file $other_partition_tmpdir; exit $fail' 0 1 2 3 15
25 framework_failure=0
26 rm -f $file || framework_failure=1
27 echo local > $file || framework_failure=1
28 echo remote > $rem_file || framework_failure=1
29 ln -s $rem_file $rem_symlink || framework_failure=1
31 if test $framework_failure = 1; then
32 echo 'failure in testing framework'
33 exit 1
36 # This mv command should succeed, unlinking the symlink
37 # before copying.
38 mv $file $rem_symlink || fail=1
40 # Make sure $file is gone.
41 test -f $file && fail=1
43 # Make sure $rem_file is unmodified.
44 test `cat $rem_file` = remote || fail=1
46 exit $fail