Bug 443

Summary: df fails on "/"
Product: Busybox Reporter: Frank baumgart <frank.baumgart>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs, frank.baumgart
Priority: P5    
Version: 1.14.x   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: i386-linux-gnu Target: i386-linux-gnu
Build: i386-linux-gnu

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!