Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Nov 2008 04:54:56 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Max Laier <max@love2party.net>
Cc:        freebsd-hackers@freebsd.org, koitsu@freebsd.org, pjd@freebsd.org, Pete French <petefrench@ticketswitch.com>, lhmwzy@gmail.com
Subject:   Re: du -A / -B options [Re: zfs quota question]
Message-ID:  <87myge6fwf.fsf@kobe.laptop>
In-Reply-To: <200811050339.52088.max@love2party.net> (Max Laier's message of "Wed, 5 Nov 2008 03:39:51 %2B0100")
References:  <E1KnA2b-0007ls-8u@dilbert.ticketswitch.com> <200811042342.49827.max@love2party.net> <87prlagayp.fsf@kobe.laptop> <200811050339.52088.max@love2party.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 5 Nov 2008 03:39:51 +0100, Max Laier <max@love2party.net> wrote:
>> That looks nice!  With a small fix (``how _much_ space'') I like the
>> idea a lot :)
>>
>> The patch fails to apply on a recent /head snapshot of du though:
> ...
>> Can you please refresh and repost it?
>
> Hum ... are you sure your snapshot is up to date?  I did some style(9)
> cleanup in r184654/6 that you might not have yet.  Anyways ... here is
> a diff with those revisions included.

Ah, that's it then.  I ran 'svn up' at the change right *before* the
HPS-USB commit and the latest du stuff was missing.  Thanks :)

The patch works fine here.  I only had to make a tiny change, to avoid a
core dump when the -B blocksize is invalid as an integer and it caused a
division by zero in fts:

$ ./du -B abcde
Floating point exception: 8 (core dumped)

Here's a diff of all the local changes I made:

%%%
diff -r a3da3ebb57ab usr.bin/du/du.1
--- a/usr.bin/du/du.1	Wed Nov 05 04:47:07 2008 +0200
+++ b/usr.bin/du/du.1	Wed Nov 05 04:53:28 2008 +0200
@@ -72,7 +72,7 @@
 .Fl k, m
 options or setting
 .Ev BLOCKSIZE
-and gives an estimate of how many space the examined file hierachy would
+and gives an estimate of how much space the examined file hierachy would
 require on a filesystem with the given
 .Ar blocksize .
 Unless in
@@ -160,7 +160,7 @@
 or
 .Fl h
 options are not specified, the block counts will be displayed in units of
-that size block.
+that block size.
 If
 .Ev BLOCKSIZE
 is not set, and the
diff -r a3da3ebb57ab usr.bin/du/du.c
--- a/usr.bin/du/du.c	Wed Nov 05 04:47:07 2008 +0200
+++ b/usr.bin/du/du.c	Wed Nov 05 04:53:28 2008 +0200
@@ -117,7 +117,7 @@
 		case 'B':
 			errno = 0;
 			cblocksize = atoi(optarg);
-			if (errno == ERANGE || cblocksize < 0) {
+			if (errno == ERANGE || cblocksize <= 0) {
 				warnx("invalid argument to option B: %s",
 				    optarg);
 				usage();
%%%




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87myge6fwf.fsf>