bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Paul Eggert
Subject: Re: bug#9140: Coreutils Bug on OSX 10.7 (Lion)
Date: Fri, 22 Jul 2011 10:26:04 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11

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.

>From 3d2ecb41c4a3e428e8a455c4f5fef49f50144f0f Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Fri, 22 Jul 2011 10:07:18 -0700
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>.
---
 ChangeLog     |    8 ++++++++
 m4/fsusage.m4 |   18 +++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b95e9d6..b652f25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-07-22  Paul Eggert  <address@hidden>
 
+       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>.
+
        large-inode: New module
        * MODULES.html.sh: Add it.
        * modules/large-inode, m4/large-inode.m4: New files.
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index 3459e63..41c06bc 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -40,7 +40,7 @@ ac_fsusage_space=no
 # systems.  That system is reported to work fine with STAT_STATFS4 which
 # is what it gets when this test fails.
 if test $ac_fsusage_space = no; then
-  # glibc/{Hurd,kFreeBSD}, MacOS X >= 10.4, FreeBSD >= 5.0, NetBSD >= 3.0,
+  # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
   # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS.
   AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs],
                  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -56,8 +56,16 @@ a system call.
 "Do not use Tru64's statvfs implementation"
 #endif
 
-#include <sys/statvfs.h>]],
-                                    [[struct statvfs fsd; statvfs (0, 
&fsd);]])],
+#include <limits.h>
+#include <sys/statvfs.h>
+
+/* 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];
+]],
+                                    [[statvfs (0, &fsd);]])],
                                  [fu_cv_sys_stat_statvfs=yes],
                                  [fu_cv_sys_stat_statvfs=no])])
   if test $fu_cv_sys_stat_statvfs = yes; then
@@ -94,8 +102,8 @@ if test $ac_fsusage_space = no; then
 fi
 
 if test $ac_fsusage_space = no; then
-  # glibc/Linux, MacOS X < 10.4, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
-  # (glibc/{Hurd,kFreeBSD}, MacOS X >= 10.4, FreeBSD >= 5.0, NetBSD >= 3.0,
+  # glibc/Linux, MacOS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
+  # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
   # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.)
   # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and
   # <sys/vfs.h>.)
-- 
1.7.4.4




reply via email to

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