mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 18:56:39 +02:00
The symlink handling in commit v8.21-172-g33660b4 was incomplete
in the case where there were symlinks in the mount list itself.
For example, in the case where /dev/mapper/fedora-home was in the
mount list and that in turn was a symlink to /dev/dm-2, we have:
before> df --out=source /dev/mapper/fedora-home
devtmpfs
after > df --out=source /dev/mapper/fedora-home
/dev/mapper/fedora-home
* src/df.c (get_disk): Compare canonicalized device names from
the mount list. Note we still display the non canonicalized name,
even if longer, as we assume that is the most representative.
* tests/df/df-symlink.sh: This could theoretically fail on some systems
depending on the content of the mount list, but adjust to fail on any
system where symlinks are present in the mount list for the current dir.
39 lines
1.4 KiB
Bash
Executable File
39 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Ensure that df dereferences symlinks to disk nodes
|
|
|
|
# Copyright (C) 2013-2014 Free Software Foundation, Inc.
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
|
print_ver_ df
|
|
|
|
disk=$(df --out=source '.' | tail -n1) ||
|
|
skip_ "cannot determine '.' file system"
|
|
|
|
ln -s "$disk" symlink || framework_failure_
|
|
|
|
df --out=source,target "$disk" > exp || skip_ "cannot get info for $disk"
|
|
df --out=source,target symlink > out || fail=1
|
|
compare exp out || fail=1
|
|
|
|
# Ensure we output the same values for device nodes and '.'
|
|
# This was not the case in coreutil-8.22 on systems
|
|
# where the device in the mount list was a symlink itself.
|
|
# I.E. '.' => /dev/mapper/fedora-home -> /dev/dm-2
|
|
df --out=source,target '.' > out || fail=1
|
|
compare exp out || fail=1
|
|
|
|
Exit $fail
|