1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 03:12:48 +02:00

df: output placeholder values for inaccessible mount points

A system provided mount entry may be unavailable due to TOCTOU race,
or if another device has been over-mounted at that position, or due to
access permissions.  In all these cases output "-" placeholder values
rather than either producing an error, or in the over-mount case
outputting values for the wrong device.

* src/df.c (device_list): A new global list now updated by
filter_mount_list().
(filter_mount_list): Adjust to take a parameter as to whether
update the global mount list, or only the mount <-> device ID mapping.
(get_dev): Use the device ID mapping to ensure we're not outputting
stats for the wrong device.  Also output placeholder values when we
can't access a system specified mount point.
(get_all_entries): Set the DEVICE_ONLY param for filter_mount_list().
(devname_for_dev): A new function to search the mount <-> dev mapping.
* test/df/skip-duplicates.sh: Adjust accordingly.
* NEWS: Mention the bug fixes.

Discussed at: http://bugs.gnu.org/16539
This commit is contained in:
Pádraig Brady
2014-06-04 00:09:11 +01:00
parent b7bb499496
commit 9d736f8dbf
3 changed files with 89 additions and 32 deletions

6
NEWS
View File

@@ -44,8 +44,10 @@ GNU coreutils NEWS -*- outline -*-
[These dd bugs were present in "the beginning".]
df now elides duplicates for virtual file systems like tmpfs, and will
display the correct device name for directories mounted multiple times.
df now elides duplicates for virtual file systems like tmpfs.
Displays the correct device details for points mounted multiple times.
Displays placeholder values for inaccessible file systems,
rather than error messages or values for the wrong file system.
[These bugs were present in "the beginning".]
du now silently ignores directory cycles introduced with bind mounts.