[BusyBox] [PATCH] fix df with long device names and big disks
Colin Watson
cjwatson at debian.org
Wed Dec 22 05:20:13 UTC 2004
Hi,
When invoked on a system with some long block device names (e.g. RAID
controllers plus devfs-style paths) and disks of at least 100GB, df can
run together the device name and the size, like this:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/cciss/host0/target0/part1563990864 334724 535007028 0% /target
This caused badness in an installation environment, reported as
https://bugzilla.ubuntu.com/show_bug.cgi?id=4875. I've attached a patch
against current CVS to ensure that there's always at least one space
between the device name and the size. It leaves the output otherwise
unchanged.
Thanks,
--
Colin Watson [cjwatson at debian.org]
-------------- next part --------------
Index: coreutils/df.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/df.c,v
retrieving revision 1.58
diff -p -u -r1.58 df.c
--- coreutils/df.c 3 Aug 2004 00:14:01 -0000 1.58
+++ coreutils/df.c 22 Dec 2004 04:55:38 -0000
@@ -136,7 +136,7 @@ extern int df_main(int argc, char **argv
}
#ifdef CONFIG_FEATURE_HUMAN_READABLE
- bb_printf("%-21s%9s ", device,
+ bb_printf("%-20s %9s ", device,
make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
bb_printf("%9s ",
@@ -147,7 +147,7 @@ extern int df_main(int argc, char **argv
make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
blocks_percent_used, mount_point);
#else
- bb_printf("%-21s%9ld %9ld %9ld %3ld%% %s\n",
+ bb_printf("%-20s %9ld %9ld %9ld %3ld%% %s\n",
device,
kscale(s.f_blocks, s.f_bsize),
kscale(s.f_blocks-s.f_bfree, s.f_bsize),
More information about the busybox
mailing list