2 # Ensure that df dereferences symlinks to file system nodes
4 # Copyright (C) 2013-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
22 file_system
=$
(df
--out=source '.' |
tail -n1) ||
23 skip_
"cannot determine '.' file system"
25 ln -s "$file_system" symlink || framework_failure_
27 df
--out=source,target
"$file_system" > exp ||
28 skip_
"cannot get info for $file_system"
29 df
--out=source,target symlink
> out || fail
=1
30 compare exp out || fail
=1
32 # Ensure we output the same values for device nodes and '.'
33 # This was not the case in coreutils-8.22 on systems
34 # where the device in the mount list was a symlink itself.
35 # I.e., '.' => /dev/mapper/fedora-home -> /dev/dm-2
36 # Restrict this test to systems with a 1:1 mapping between
37 # source and target. This excludes for example BTRFS sub-volumes.
38 if test "$(df --output=source | grep -F "$file_system" | wc -l)" = 1; then
39 # Restrict to systems with a single file system root (and have findmnt(1))
40 if test "$(findmnt -nro FSROOT | uniq | wc -l)" = 1; then
41 df
--out=source,target
'.' > out || fail
=1
42 compare exp out || fail
=1
46 test "$fail" = 1 && dump_mount_list_