bug-coreutils
[Top][All Lists]
Advanced

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

Re: Patch for coreutils 4.5.7 on Mac OS X


From: Paul Eggert
Subject: Re: Patch for coreutils 4.5.7 on Mac OS X
Date: Tue, 03 Aug 2004 23:04:43 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Re this old bug report:

http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html

I installed this patch into coreutils.  Thanks for reporting the bug,
and sorry about the delay in fixing it.

2004-08-03  Paul Eggert  <address@hidden>

        * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
        whether to include files.  Include <sys/param.h> if
        HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
        (main) [defined __POWERPC__]: Add a kludge to work around a
        Mac OS X bug, so that uname -p defaults to "powerpc" if
        sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
        fails.  Problem reported by Petter Reinholdtsen in:
        http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html

Index: uname.c
===================================================================
RCS file: /home/eggert/coreutils/cu/src/uname.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -p -u -r1.60 -r1.61
--- uname.c     3 Aug 2004 23:14:17 -0000       1.60
+++ uname.c     4 Aug 2004 05:58:43 -0000       1.61
@@ -29,8 +29,10 @@
 # include <sys/systeminfo.h>
 #endif
 
-#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
-# include <sys/param.h> /* needed for OpenBSD 3.0 */
+#if HAVE_SYS_SYSCTL_H
+# if HAVE_SYS_PARAM_H
+#  include <sys/param.h> /* needed for OpenBSD 3.0 */
+# endif
 # include <sys/sysctl.h>
 # ifdef HW_MODEL
 #  ifdef HW_MACHINE_ARCH
@@ -260,6 +262,11 @@ main (int argc, char **argv)
          static int mib[] = { CTL_HW, UNAME_PROCESSOR };
          if (sysctl (mib, 2, processor, &s, 0, 0) >= 0)
            element = processor;
+# ifdef __POWERPC__
+         /* This kludge works around a bug in Mac OS X.  */
+         if (element == unknown)
+           element = "powerpc";
+# endif
        }
 #endif
       print_element (element);




reply via email to

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