Bug 11292 - df fails to show fs of a non-mounted-fs device file
Summary: df fails to show fs of a non-mounted-fs device file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: fileutils
Version: 6.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-05-08 07:06 UTC by James Manning
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-05-08 07:06:45 UTC
Embargoed:


Attachments (Terms of Use)

Description James Manning 2000-05-08 07:06:45 UTC
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
itself:

--- 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);
        return;
       }
-  /* 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);
   else
     show_point (path, statp);
 }

Comment 1 Bernhard Rosenkraenzer 2000-08-04 19:41:46 UTC
This is fixed in 4.0x


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