[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] [PATCH] fix df with long device names and big disks
From:       Colin Watson <cjwatson () debian ! org>
Date:       2004-12-22 5:20:13
Message-ID: 20041222052013.GB1678 () riva ! ucam ! org
[Download RAW message or body]

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@debian.org]

["busybox-df.diff" (text/plain)]

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),


_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic