[BusyBox 0004744]: /bin/df & WHY_IT_SHOULD_BE_HIDDEN

bugs at busybox.net bugs at busybox.net
Thu Aug 28 07:21:28 UTC 2008


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=4744 
====================================================================== 
Reported By:                zhuangyy
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   4744
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             08-27-2008 01:54 PDT
Last Modified:              08-28-2008 00:21 PDT
====================================================================== 
Summary:                    /bin/df & WHY_IT_SHOULD_BE_HIDDEN
Description: 
I've just upgraded my busybox from 1.4.2 to 1.11.2, an error related to a
shell script of mine is immediately popped up when i am rebooting my
system.
After some digs on this problem, I found that the output of /bin/df is
changed from these two versions of busybox. 

in 1.4.2, it will output:
/dev/hda1 xxx xxx xx 92% /

but in 1.11.1, it will output:
rootfs xx xx xx xx% /
/dev/root xx xx  xx 92% /

By taking a look at the source code df.c, i noticed that some code is
commented out by WHY_IT_SHOULD_BE_HIDDEN &
WHY_WE_DO_IT_FOR_DEV_ROOT_ONLY.

I think the answer should be yes. because output /dev/root is useless for
program processing (ie. shell script). for example, if i want to run fsck
on root device (i do not which it is, it can be hda1 or hdc1 or sda1 and
so on), i can just use df to find the root device then run fsck on it.

what's more, output /dev/hda1 is more compliant to normal linux df
output.

thanks.


====================================================================== 

---------------------------------------------------------------------- 
 vda - 08-27-08 14:33  
---------------------------------------------------------------------- 
It's coreutils compat:

bash-3.2# /usr/bin/df --version
df (GNU coreutils) 6.9
...

bash-3.2# /usr/bin/df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  964500    598724    316780  66% /
/dev/root               964500    598724    316780  66% /
/dev/sda6             15622684   7281860   8340824  47% /.share
/dev/sda7             97656112  94548720   3107392  97% /.1
/dev/sda8            171930376 148124504  23805872  87% /.2
/dev/sda6             15622684   7281860   8340824  47% /.local

bash-3.2# df --help
BusyBox v1.12.0.svn (2008-08-21 01:18:52 CEST) multi-call binary

bash-3.2# df
Filesystem           1k-blocks      Used Available Use% Mounted on
rootfs                  964500    598724    316780  65% /
/dev/root               964500    598724    316780  65% /
/dev/sda6             15622684   7281860   8340824  47% /.share
/dev/sda7             97656112  94548720   3107392  97% /.1
/dev/sda8            171930376 148124504  23805872  86% /.2
/dev/sda6             15622684   7281860   8340824  47% /.local 

---------------------------------------------------------------------- 
 vda - 08-27-08 14:34  
---------------------------------------------------------------------- 
If you can find a case where we differ from coreutils df, *that* is
probably a bug. 

---------------------------------------------------------------------- 
 zhuangyy - 08-27-08 18:15  
---------------------------------------------------------------------- 
my debian box:

test:~# df --version
df (GNU coreutils) 5.97
...

test:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1             76185728   1729628  70586044   3% /
tmpfs                   124168         0    124168   0% /lib/init/rw
udev                     10240        40     10200   1% /dev
tmpfs                   124168         0    124168   0% /dev/shm

I guess /dev/root will be displayed if there is no /etc/fstab exist.

how about add an option to busybox df? if this option is on, df will
ignore rootfs and output the real device of /dev/root
(find_block_device("/")). so a shell script can use df to find the real
root device and then run fsck or other operations on it.

I am maintaining a program running on multiple hardware platforms of
different root devices. 

If you do not want to include this feature in busybox official release,
would you please keep those codes so i can patch the df.c myself? 

---------------------------------------------------------------------- 
 bernhardf - 08-28-08 00:21  
---------------------------------------------------------------------- 
$ df --version 2>&1 >&1 | sed 1q
df (GNU coreutils) 6.10

$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda6             85546040  76371096   4829364  95% /
tmpfs                  1037552         0   1037552   0% /lib/init/rw
udev                     10240       112     10128   2% /dev
tmpfs                  1037552         0   1037552   0% /dev/shm
/dev/sda3               482246     78194    379152  18% /boot
$ /tmp/busybox/busybox df
Filesystem           1k-blocks      Used Available Use% Mounted on
rootfs                85546040  76371096   4829364  94% /
udev                     10240       112     10128   1% /dev
/dev/sda6             85546040  76371096   4829364  94% /
/dev/sda6             85546040  76371096   4829364  94% /dev/.static/dev
tmpfs                  1037552         0   1037552   0% /lib/init/rw
tmpfs                  1037552         0   1037552   0% /dev/shm
/dev/sda3               482246     78194    379152  17% /boot

The input is as follows:
$ cat /proc/mounts 
rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec 0 0
none /proc proc rw,nosuid,nodev,noexec 0 0
udev /dev tmpfs rw 0 0
/dev/sda6 / ext3 rw 0 0
/dev/sda6 /dev/.static/dev ext3 rw 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid 0 0
usbfs /proc/bus/usb usbfs rw,nosuid,nodev,noexec 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec 0 0
/dev/sda3 /boot ext3 ro 0 0
debugfs /sys/kernel/debug debugfs rw 0 0
automount(pid4299) /home autofs 
nfsd /proc/fs/nfsd nfsd rw 0 0 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-27-08 01:54  zhuangyy       New Issue                                    
08-27-08 01:54  zhuangyy       Status                   new => assigned     
08-27-08 01:54  zhuangyy       Assigned To               => BusyBox         
08-27-08 14:33  vda            Note Added: 0010804                          
08-27-08 14:34  vda            Note Added: 0010814                          
08-27-08 18:15  zhuangyy       Note Added: 0010834                          
08-28-08 00:21  bernhardf      Note Added: 0010844                          
======================================================================




More information about the busybox-cvs mailing list