From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 3 18:00:13 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 493C11065673 for ; Mon, 3 Aug 2009 18:00:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0BAAD8FC14 for ; Mon, 3 Aug 2009 18:00:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n73I0Ca5007733 for ; Mon, 3 Aug 2009 18:00:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n73I0CY0007732; Mon, 3 Aug 2009 18:00:12 GMT (envelope-from gnats) Resent-Date: Mon, 3 Aug 2009 18:00:12 GMT Resent-Message-Id: <200908031800.n73I0CY0007732@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Craig R Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CA6B1065687 for ; Mon, 3 Aug 2009 17:57:49 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 5B6468FC1D for ; Mon, 3 Aug 2009 17:57:49 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n73HvnIH098760 for ; Mon, 3 Aug 2009 17:57:49 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n73HvmxU098759; Mon, 3 Aug 2009 17:57:48 GMT (envelope-from nobody) Message-Id: <200908031757.n73HvmxU098759@www.freebsd.org> Date: Mon, 3 Aug 2009 17:57:48 GMT From: Craig R To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/137399: du with gigabyte units X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2009 18:00:13 -0000 >Number: 137399 >Category: misc >Synopsis: du with gigabyte units >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Aug 03 18:00:12 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Craig R >Release: 7.0 >Organization: Backfire.ca >Environment: >Description: df supports the -g option, which uses gigs for units. This patch blesses du with the same functionality. >How-To-Repeat: Run du with -g, watch it complain. >Fix: Apply attached patch liberally. Repeat if desired. Patch attached with submission follows: --- du.c.old 2009-08-03 13:46:33.000000000 -0400 +++ du.c 2009-08-03 13:51:36.000000000 -0400 @@ -103,7 +103,7 @@ depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "HI:LPasd:chkmnrx")) != -1) + while ((ch = getopt(argc, argv, "HI:LPasd:cghkmnrx")) != -1) switch (ch) { case 'H': Hflag = 1; @@ -139,6 +139,10 @@ case 'c': cflag = 1; break; + case 'g': + hflag = 0; + setenv("BLOCKSIZE", "1073741824", 1); + break; case 'h': setenv("BLOCKSIZE", "512", 1); hflag = 1; @@ -443,7 +447,7 @@ usage(void) { (void)fprintf(stderr, - "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k | -m] [-n] [-x] [-I mask] [file ...]\n"); + "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-g | -h | -k | -m] [-n] [-x] [-I mask] [file ...]\n"); exit(EX_USAGE); } >Release-Note: >Audit-Trail: >Unformatted: