2 # Make sure we give a sensible diagnostic when a cross-device 'mv'
3 # fails, e.g., because the destination cannot be unlinked.
4 # This is a bit fragile since it relies on the string used
5 # for EPERM: 'permission denied'.
7 # Copyright (C) 2002-2024 Free Software Foundation, Inc.
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
22 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
25 cleanup_
() { t
=$other_partition_tmpdir; chmod -R 700 "$t"; rm -rf "$t"; }
26 .
"$abs_srcdir/tests/other-fs-tmpdir"
28 touch k
"$other_partition_tmpdir/k" || framework_failure_
29 chmod u-w
"$other_partition_tmpdir" || framework_failure_
32 mv -f k
"$other_partition_tmpdir" 2> out
&& fail
=1
34 "mv: inter-device move failed: '%s' to '%s';"\
35 ' unable to remove target: Permission denied\n' \
36 k
"$other_partition_tmpdir/k" >exp
38 # On some (less-compliant) systems, we get EPERM in this case.
39 # Accept either diagnostic.
41 mv: cannot move 'k' to '$other_partition_tmpdir/k': Permission denied
44 if cmp out exp
>/dev
/null
2>&1; then
53 test $fail = 1 && compare exp out