From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 13 11:42:27 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 79B1016A4CE for ; Mon, 13 Dec 2004 11:42:27 +0000 (GMT) Received: from mail.squidge.com (mail0.squidge.com [195.10.252.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 97D3643D5F for ; Mon, 13 Dec 2004 11:42:26 +0000 (GMT) (envelope-from henry@jot.to) Received: from tickle (tickle.netcraft.com [195.92.95.103]) (authenticated bits=0) by mail.squidge.com (8.13.1/8.12.9) with ESMTP id iBDBgMp4082138 for ; Mon, 13 Dec 2004 11:42:22 GMT Message-Id: <200412131142.iBDBgMp4082138@mail.squidge.com> From: "henry" To: Date: Mon, 13 Dec 2004 11:42:17 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcThCMwaTwUgGpJLR1SK+cqp6CjI9A== X-Virus-Scanned: by AMaViS at mail.squidge.com X-Spam-Level: 3.9 X-Mailman-Approved-At: Mon, 13 Dec 2004 13:08:53 +0000 Subject: du(1)/fts(3) integer overflow X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Dec 2004 11:42:27 -0000 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?