Date: Sun, 1 Dec 2002 22:08:54 +0900 (JST) From: Kawaguti Ginga <ginga-freebsd@ginganet.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: ginga-freebsd@ginganet.org Subject: bin/45897: /usr/bin/du option -h -k conflicts. Message-ID: <20021201130854.2EAC33E58@athena.ginganet.org>
next in thread | raw e-mail | index | archive | help
>Number: 45897
>Category: bin
>Synopsis: /usr/bin/du option -h -k conflicts.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Dec 01 05:10:01 PST 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021201130854.2EAC33E58>
