bin/66976: du doesn't have a -m argument
Vasily Korytov
deskpot at msk.yell.ru
Fri May 21 02:10:20 PDT 2004
>Number: 66976
>Category: bin
>Synopsis: du doesn't have a -m argument
>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: Fri May 21 02:10:15 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator: Vasily Korytov
>Release: FreeBSD 4.9-RELEASE-p5 i386
>Organization:
YPI Yellow Pages LTD
>Environment:
System: FreeBSD ns2.yellow-pages.spb.ru 4.9-RELEASE-p5 FreeBSD 4.9-RELEASE-p5 #0: Wed Apr 21 12:04:37 MSD 2004 root at ns2.yellow-pages.spb.ru:/usr/obj/usr/src/sys/NS2 i386
>Description:
du(1) that comes with FreeBSD does not understand the -m argument
(BLOCKSIZE=1m). As far as I know, this option is not required by
POSIX, but it's commonly used in other du implementations -- for
example, NetBSD and GNU, so this can really confuse users, which
don't use only FreeBSD systems.
>How-To-Repeat:
Type `du -m .` and it reports: ``du: illegal option -- m''
>Fix:
A patch for du.c and du.1 is included.
--- du.patch begins here ---
diff -u /usr/src/usr.bin/du/du.1 ./du.1
--- /usr/src/usr.bin/du/du.1 Tue Feb 25 01:37:41 2003
+++ ./du.1 Thu May 20 13:52:10 2004
@@ -44,7 +44,7 @@
.Op Fl I Ar mask
.Op Fl a | s | d Ar depth
.Op Fl c
-.Op Fl h | k
+.Op Fl h | k | m
.Op Fl x
.Op Ar
.Sh DESCRIPTION
@@ -98,6 +98,8 @@
Display a grand total.
.It Fl k
Display block counts in 1024-byte (1-Kbyte) blocks.
+.It Fl m
+Display block counts in 1048576-byte (1-Mbyte) blocks.
.It Fl x
File system mount points are not traversed.
.El
diff -u /usr/src/usr.bin/du/du.c ./du.c
--- /usr/src/usr.bin/du/du.c Thu Dec 12 19:29:39 2002
+++ ./du.c Thu May 20 13:50:35 2004
@@ -125,7 +125,7 @@
depth = INT_MAX;
SLIST_INIT(&ignores);
- while ((ch = getopt(argc, argv, "HI:LPasd:chkrx")) != -1)
+ while ((ch = getopt(argc, argv, "HI:LPasd:chkmrx")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -170,6 +170,10 @@
if (!hflag)
putenv("BLOCKSIZE=1024");
break;
+ case 'm':
+ if (!hflag)
+ putenv("BLOCKSIZE=1048576");
+ break;
case 'r': /* Compatibility. */
break;
case 'x':
@@ -391,7 +395,7 @@
usage()
{
(void)fprintf(stderr,
- "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k] [-x] [-I mask] [file ...]\n");
+ "usage: du [-H | -L | -P] [-a | -s | -d depth] [-c] [-h | -k | -m] [-x] [-I mask] [file ...]\n");
exit(EX_USAGE);
}
--- du.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list