From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 5 02:55:12 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AC141065672; Wed, 5 Nov 2008 02:55:12 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 136918FC18; Wed, 5 Nov 2008 02:55:11 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl92-78.kln.forthnet.gr [77.49.59.78]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id mA52t3sw012539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 5 Nov 2008 04:55:08 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id mA52t3Ze001795; Wed, 5 Nov 2008 04:55:03 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id mA52t3hw001794; Wed, 5 Nov 2008 04:55:03 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Max Laier In-Reply-To: <200811050339.52088.max@love2party.net> (Max Laier's message of "Wed, 5 Nov 2008 03:39:51 +0100") Date: Wed, 05 Nov 2008 04:54:56 +0200 Message-ID: <87myge6fwf.fsf@kobe.laptop> References: <200811042342.49827.max@love2party.net> <87prlagayp.fsf@kobe.laptop> <200811050339.52088.max@love2party.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: mA52t3sw012539 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.854, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.55, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-hackers@freebsd.org, koitsu@freebsd.org, pjd@freebsd.org, Pete French , lhmwzy@gmail.com Subject: Re: du -A / -B options [Re: zfs quota question] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2008 02:55:12 -0000 On Wed, 5 Nov 2008 03:39:51 +0100, Max Laier 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(); %%%