Bug 11292 - df fails to show fs of a non-mounted-fs device file
df fails to show fs of a non-mounted-fs device file
Product: Red Hat Linux
Classification: Retired
Component: fileutils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Depends On:
  Show dependency treegraph
Reported: 2000-05-08 03:06 EDT by James Manning
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-05-08 03:06:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description James Manning 2000-05-08 03:06:45 EDT
As per man page, df should show the filesystem if you pass the device node
of a mounted filesystem, but otherwise should fallback to the filesystem
that the device node is located in.  Currently just calls a show_dev with
lots of zero fields, effectively killing the filesystem field.  Simple fix
is to call show_point along this failure path.  Many different possible
fixes, all about equally elegant.  One approach (fairly small patch) is to
simply pass show_disk one more param so it's capable of calling show_point

--- fileutils-4.0p/src/df.c.jmm Mon May  8 02:42:13 2000
+++ fileutils-4.0p/src/df.c     Mon May  8 03:03:21 2000
@@ -433,8 +433,10 @@
 /* Identify the directory, if any, that device
    DISK is mounted on, and show its disk usage.  */

+static void show_point (const char *disk, const struct stat *statp);

 static void
-show_disk (const char *disk)
+show_disk (const char *disk, const struct stat *statp)
   struct mount_entry *me;

@@ -445,8 +447,8 @@
                  me->me_dummy, me->me_remote);
-  /* No filesystem is mounted on DISK. */
-  show_dev (disk, (char *) NULL, (char *) NULL, 0, 0);
+  /* No filesystem is mounted on DISK, fall back to show_point. */
+  show_point (disk, statp);

 /* Return the root mountpoint of the filesystem on which FILE exists, in
@@ -706,7 +708,7 @@
 show_entry (const char *path, const struct stat *statp)
   if (S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
-    show_disk (path);
+    show_disk (path, statp);
     show_point (path, statp);
Comment 1 Bernhard Rosenkraenzer 2000-08-04 15:41:46 EDT
This is fixed in 4.0x

Note You need to log in before you can comment on or make changes to this bug.