Bug 443 - df fails on "/"
Summary: df fails on "/"
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.14.x
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-05 19:44 UTC by Frank baumgart
Modified: 2009-07-05 21:40 UTC (History)
2 users (show)

See Also:
Host: i386-linux-gnu
Target: i386-linux-gnu
Build: i386-linux-gnu


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank baumgart 2009-07-05 19:44:12 UTC
root@pep:/bin # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root               984871    332387    652484  34% /
/dev/ram                452360       536    451824   0% /var
root@pep:/bin # df -m /var
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/ram                   442         1       441   0% /var
root@pep:/bin # df -m /
Filesystem           1M-blocks      Used Available Use% Mounted on

that's it, no output.
Comment 1 Frank baumgart 2009-07-05 19:47:04 UTC
root@pep:/bin # df -m /dev/root
Filesystem           1M-blocks      Used Available Use% Mounted on
df: /dev/root: can't find mount point

df works fine on /dev/ram as well as other devices mounted
Comment 2 Denys Vlasenko 2009-07-05 21:09:52 UTC
Fix:

http://busybox.net/downloads/fixes-1.14.2/busybox-1.14.2-df.patch

# ./busybox df -m /
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/root                  942       611       283  68% /

Please confirm that it works for you.


> root@pep:/bin # df -m /dev/root
> Filesystem           1M-blocks      Used Available Use% Mounted on
> df: /dev/root: can't find mount point

df (GNU coreutils) 6.9 can't do it too on my home machine.
Why?
It does not work if /dev/root actually does not exist. find_mount_point() stat's /dev/root and matches its device number to each entry in /proc/mounts, it does not do only textual match. So, if there is not /dev/root, stat fails and nothing matches.
Comment 3 Frank baumgart 2009-07-05 21:40:04 UTC
patch fixes the "df /" issue.
propose to close this bug entry as "df /dev/root" for not existing mount point behaves like coreutils.

Thanks!