Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Dec 2004 11:42:17 -0000
From:      "henry" <henry@jot.to>
To:        <freebsd-hackers@freebsd.org>
Subject:   du(1)/fts(3)  integer overflow
Message-ID:  <200412131142.iBDBgMp4082138@mail.squidge.com>

next in thread | raw e-mail | index | archive | help
I have noticed a problem with the fts(3) library or the way du(1) interacts
with it.

A 3.2TiB file gives the following output:
> du -cs /fs/file
3408720016      /fs/file
-886247279      total
> du -hcs /fs/file
3.2T    /fs/file
        total
> 

This is because while stat(2) reports blocks as a 64bit number du(1) uses
the 32bit value FTSENT.fts_number to store the result:
du.c (1.36):
269:                            p->fts_parent->fts_number +=
p->fts_statp->st_blocks;
270:            }
271:            savednumber = p->fts_parent->fts_number;
272:    }

The simplest change appears to be to make fts_number 64bit however this
changes the fts(3) abi, so I am not sure if this is acceptable.

Thoughts?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412131142.iBDBgMp4082138>