From ginga@athena.ginganet.org  Sun Dec  1 05:09:04 2002
Return-Path: <ginga@athena.ginganet.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 74FED37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  1 Dec 2002 05:09:04 -0800 (PST)
Received: from athena.ginganet.org (tk0008-202x210x243x26.ap-TK.usen.ad.jp [202.210.243.26])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6180143EB2
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  1 Dec 2002 05:09:00 -0800 (PST)
	(envelope-from ginga@athena.ginganet.org)
Received: by athena.ginganet.org (Postfix, from userid 5003)
	id 2EAC33E58; Sun,  1 Dec 2002 22:08:54 +0900 (JST)
Message-Id: <20021201130854.2EAC33E58@athena.ginganet.org>
Date: Sun,  1 Dec 2002 22:08:54 +0900 (JST)
From: Kawaguti Ginga <ginga-freebsd@ginganet.org>
Reply-To: Kawaguti Ginga <ginga-freebsd@ginganet.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: ginga-freebsd@ginganet.org
Subject: /usr/bin/du option -h -k conflicts.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45897
>Category:       bin
>Synopsis:       /usr/bin/du option -h -k conflicts.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 01 05:10:01 PST 2002
>Closed-Date:    Thu Dec 12 08:35:54 PST 2002
>Last-Modified:  Thu Dec 12 08:35:54 PST 2002
>Originator:     Kawaguti Ginga
>Release:        FreeBSD 4.7-RC i386
>Organization:
>Environment:
System: FreeBSD 4.7-RC  i386

	
>Description:
	/usr/bin/du 's option -h and -k conflicts when -k is added
	AFTER -h option. When -k option is provided after -h option,
	it reports half the amount of data.	
>How-To-Repeat:
	% mkdir /tmp/test
	% cd /tmp/test
	% dd if=/dev/zero of=foo count=100	# 5kB
	% ls -l foo
	-rw-r--r--  1 ginga  wheel  51200 Dec  1 21:59 foo
	% du -sk .
	51	.
	% du -skh .
	 51K	.	# right
	% du -shk .
	 26K	.	# wrong! (only 1/2 reported)
	% 
	
>Fix:

--- /usr/src/usr.bin/du/du.c	Thu Jul 12 17:46:53 2001
+++ du.c	Sun Dec  1 21:51:45 2002
@@ -167,7 +167,9 @@
 				valp = vals_base2;
 				break;
 			case 'k':
-				putenv("BLOCKSIZE=1024");
+			        if (hflag == 0){
+				  putenv("BLOCKSIZE=1024");
+				}
 				break;
 			case 'r':		 /* Compatibility. */
 				break;

--- /usr/src/usr.bin/du/du.1	Fri Jun 21 08:45:43 2002
+++ du.1	Sun Dec  1 22:05:01 2002
@@ -97,7 +97,7 @@
 .It Fl c
 Display a grand total.
 .It Fl k
-Display block counts in 1024-byte (1-Kbyte) blocks.
+Display block counts in 1024-byte (1-Kbyte) blocks(not valid when applied with -h).
 .It Fl x
 Filesystem mount points are not traversed.
 .El


>Release-Note:
>Audit-Trail:

From: Kawaguti Ginga <ginga@ginganet.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc: Kawaguti Ginga <ginga-freebsd@ginganet.org>
Subject: Re: bin/45897: /usr/bin/du option -h -k conflicts.
Date: Thu, 5 Dec 2002 11:43:30 +0900

 In Sun, Dec 01, 2002 at 05:10:01AM -0800,
 FreeBSD-gnats-submit@FreeBSD.org wrote:
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=45897
 > 
 > >Category:       bin
 > >Responsible:    freebsd-bugs
 > >Synopsis:       /usr/bin/du option -h -k conflicts.
 > >Arrival-Date:   Sun Dec 01 05:10:01 PST 2002
 
 This problem was already fixed in the -current
 (remained only for 4-stable branch).
 Sorry for reporting already fixed problem...
 -- 
 ginga
State-Changed-From-To: open->closed 
State-Changed-By: trhodes 
State-Changed-When: Thu Dec 12 08:35:12 PST 2002 
State-Changed-Why:  
I've completed the MFC (different patch).  Thanks for pointing this out! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45897 
>Unformatted:
