Subject: Re: bug#9140: Coreutils Bug on OSX 10.7 (Lion)

From: Jim Meyering <[email-masked]>
Date: Fri, 22 Jul 2011 20:15:58 +0200

Paul Eggert wrote:
> Thanks for the further information about the problem with MacOS X 10.7.
> Can you please try this patch?  If you don't have autotools installed,
> you can edit 'configure' by hand and install a similar patch there.
> Thanks.
>
> I have pushed this into gnulib as it seems pretty simple.  The basic
> idea is to avoid statvfs on MacOS X because its block counts can't
> go above 2**31.
>
> Subject: [PATCH 3/3] fsusage: port to MacOS X 10.7 with 4 TiB file systems
>
> * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Reject statvfs
> implementations that use only 32 bits to count blocks.
> On typical hosts with 1024-byte blocks, this fails with file
> systems as small as 4 TiB.  Problem reported by Herb Wartens
> <http://debbugs.gnu.org/9140> and this should also fix a similar
> problem reported by Tim Spriggs <http://debbugs.gnu.org/7355>.
...
> +/* Reject implementations, such as MacOS X 10.7, where f_blocks is a
> +   32-bit quantity; that commonly limits file systems to 4 TiB, a
> +   ridiculously small limit these days.  */
> +struct statvfs fsd;
> +int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
> +]],

Nice.  That looks like it will do the job, and since all statvfs
implementations have the f_blocks member, it should be safe.

Thanks.