rm: update gnulib to get an fts fix for Cygwin+NWFS/NcFsd file systems
[coreutils/ericb.git] / tests / mv / to-symlink
blob162ac55cd6aa73b765556fc0ba3730f8f2db5ff5
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 # Copyright (C) 1999-2000, 2007-2011 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 3 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, see <http://www.gnu.org/licenses/>.
20 . "${srcdir=.}/init.sh"; path_prepend_ ../src
21 print_ver_ mv
22 cleanup_() { rm -rf "$other_partition_tmpdir"; }
23 . "$abs_srcdir/other-fs-tmpdir"
25 rem_file="$other_partition_tmpdir/file"
26 rem_symlink="$other_partition_tmpdir/symlink"
27 file=to-sym
29 echo local > $file || framework_failure_
30 echo remote > $rem_file || framework_failure_
31 ln -s $rem_file $rem_symlink || framework_failure_
33 # This mv command should succeed, unlinking the symlink
34 # before copying.
35 mv $file $rem_symlink || fail=1
37 # Make sure $file is gone.
38 test -f $file && fail=1
40 # Make sure $rem_file is unmodified.
41 test `cat $rem_file` = remote || fail=1
43 Exit $fail