1#!/bin/sh
2# Ensure that hard links are preserved when moving between partitions
3# and when the links are in separate command line arguments.
4# For additional constraints, see the comment in copy.c.
5# Before coreutils-5.2.1, this test would fail.
6
7# Copyright (C) 2004-2023 Free Software Foundation, Inc.
8
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.
13
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.
18
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/>.
21
22. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
23print_ver_ mv
24cleanup_() { rm -rf "$other_partition_tmpdir"; }
25. "$abs_srcdir/tests/other-fs-tmpdir"
26
27touch f || framework_failure_
28ln f g || framework_failure_
29mkdir a b || framework_failure_
30touch a/1 || framework_failure_
31ln a/1 b/1 || framework_failure_
32
33
34mv f g "$other_partition_tmpdir" || fail=1
35mv a b "$other_partition_tmpdir" || fail=1
36
37cd "$other_partition_tmpdir"
38set $(ls -Ci f g)
39test $1 = $3 || fail=1
40set $(ls -Ci a/1 b/1)
41test $1 = $3 || fail=1
42
43Exit $fail
44