i386/89090: du reports negative numbers

Alan Amesbury amesbury at umn.edu
Tue Nov 15 14:10:28 PST 2005


>Number:         89090
>Category:       i386
>Synopsis:       du reports negative numbers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 15 22:10:19 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Alan Amesbury
>Release:        FreeBSD 5.3-RELEASE-p20 i386
>Organization:
University of Minnesota
>Environment:
System: FreeBSD [REDACTED] 5.3-RELEASE-p20 FreeBSD 5.3-RELEASE-p20 #5: Wed Jul 27 14:19:58 CDT 2005 root@[REDACTED]:/usr/obj/usr/src/sys/OITSEC-5_3-F i386


>Description:
When using 'du' to calculate disk usage for various directories, it will
report negative values for directories with large usage.  For example:

	% cd /somedir/topdir
	% df -m .
	Filesystem 1M-blocks    Used  Avail Capacity  Mounted on
	/dev/da2a    1844272 1405664 291066    83%    /somedir
	% du -sk topdir topdir/*
	-1048261423     topdir
	38612   topdir/subdir1
	1100786 topdir/subdir2
	43098   topdir/subdir3
	117342  topdir/subdir4
	4258406 topdir/subdir5
	598392  topdir/subdir6
	566349622       topdir/subdir7
	526684962       topdir/subdir8
	41498   topdir/subdir9

>How-To-Repeat:
Run 'du' on a directory with sufficient space being used.
>Fix:
The patch below *APPEARS* to fix the problem.  However, I have
NOT done any sort of regression testing, so there may be some
side effects to this patch of which I am not aware.  Caveat
emptor.

--- usr.bin/du/du.c.ORIG        Tue Nov 15 15:28:17 2005
+++ usr.bin/du/du.c     Tue Nov 15 15:46:48 2005
@@ -82,7 +82,7 @@
 {
        FTS             *fts;
        FTSENT          *p;
-       long            blocksize, savednumber = 0;
+       unsigned long           blocksize, savednumber = 0;
        int             ftsoptions;
        int             listall;
        int             depth;

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list