bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils-5.92:du not AIX largefile safe --


From: Paul Townsend
Subject: coreutils-5.92:du not AIX largefile safe --
Date: Wed, 2 Nov 2005 22:55:31 -0500 (EST)

=====
When the `du' included with coreutils-5.92 is compiled on an AIX 5.1 box
that has a 32 bit kernel and is compiled with large file support, it
incorrectly computes the size of a file that exceeds 2**31-1 bytes.  If
I've interpretted the code correctly, it's because the stat->st_blocks
entry is a signed int that's multiplied by 512 before being promoted to
an unsigned long long (uintmax_t).  The patch below forces the promotion
before the multiplication.

--  Paul Townsend (alpha a beta present at purdue dot edu)

diff -u coreutils-5.92/src/du.c.orig coreutils-5.92/src/du.c
--- coreutils-5.92/src/du.c.orig        2005-10-15 04:13:21.000000000 -0500
+++ coreutils-5.92/src/du.c     2005-11-02 02:44:21.767391000 -0500
@@ -537,7 +537,7 @@
       duinfo_set (&dui,
                  (apparent_size
                   ? sb->st_size
-                  : ST_NBLOCKS (*sb) * ST_NBLOCKSIZE),
+                  : (uintmax_t) ST_NBLOCKS (*sb) * ST_NBLOCKSIZE),
                  (time_type == time_mtime ? get_stat_mtime (sb)
                   : time_type == time_atime ? get_stat_atime (sb)
                   : get_stat_ctime (sb)));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]