[arch-commits] CVS update of core/base/coreutils (4 files)

andyrtr at archlinux.org andyrtr at archlinux.org
Sat Feb 2 12:28:17 UTC 2008


    Date: Saturday, February 2, 2008 @ 07:28:17
  Author: andyrtr
    Path: /home/cvs-core/core/base/coreutils

Modified: PKGBUILD (1.30 -> 1.31) coreutils-i18n.patch (1.5 -> 1.6)
          coreutils-pam.patch (1.3 -> 1.4) coreutils-uname.patch (1.2 -> 1.3)

upgpkg: coreutils 6.10-1


-----------------------+
 PKGBUILD              |   33 +++++------
 coreutils-i18n.patch  |   61 ++++++++++-----------
 coreutils-pam.patch   |  137 +++++++++++++++++++++++++++++++-----------------
 coreutils-uname.patch |   70 ++++++++++++++++--------
 4 files changed, 182 insertions(+), 119 deletions(-)


Index: core/base/coreutils/PKGBUILD
diff -u core/base/coreutils/PKGBUILD:1.30 core/base/coreutils/PKGBUILD:1.31
--- core/base/coreutils/PKGBUILD:1.30	Sun Dec  2 22:17:23 2007
+++ core/base/coreutils/PKGBUILD	Sat Feb  2 07:28:16 2008
@@ -1,28 +1,30 @@
-# $Id: PKGBUILD,v 1.30 2007/12/03 03:17:23 dan Exp $
+# $Id: PKGBUILD,v 1.31 2008/02/02 12:28:16 andyrtr Exp $
 # Maintainer: judd <jvinet at zeroflux.org>
 pkgname=coreutils
-pkgver=6.9
-pkgrel=4
+pkgver=6.10
+pkgrel=1
 pkgdesc="The basic file, shell and text manipulation utilities of the GNU operating system"
 arch=(i686 x86_64)
-license=('GPL')
+license=('GPL3')
 url="http://www.gnu.org/software/coreutils"
 groups=('base')
-depends=('glibc' 'shadow>=4.0.4.1-3' 'pam' 'acl')
-replaces=('sh-utils' 'fileutils' 'textutils')
+depends=('glibc>=2.7-7' 'shadow>=4.0.18.2-2' 'pam>=0.99.9.0-2' 'acl>=2.2.45-2')
+provides=('mktemp')
+conflicts=('mktemp')
+replaces=('sh-utils' 'fileutils' 'textutils' 'mktemp')
 backup=('etc/pam.d/su')
-options=('!makeflags')
+options=('!emptydirs')
 source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz
 	coreutils-i18n.patch
 	coreutils-uname.patch
 	coreutils-pam.patch
-	futimes.patch
+	coreutils-6.10-configuration.patch
 	su)
-md5sums=('62032af4d79cd99743e06d5c40c4989c'
-         'ce0239547afd626b06c016e9ada429a9'
-         '18684a4be85074048483d1efef83a6bc'
-         '0b8e18a36125207ecc0b41626c3d36e1'
-         '6ac50183975829e6463ef17abed61ebb'
+md5sums=('eca0de1bf7389694305d7e52cd76a472'
+         '3beb1fcdd7374239a7584efa9fbc4885'
+         '18d3ba178e2691242287b59bd81aedb9'
+         '8810a22cdc05d502a69b59511e9abf79'
+         '65f3338712893b282694d4601507b355'
          'fa85e5cce5d723275b14365ba71a8aad')
 
 build() {
@@ -30,13 +32,12 @@
   # added pam patch and i18n patch from fedora cvs
   patch -Np1 -i ../coreutils-pam.patch || return 1
   patch -Np1 -i ../coreutils-i18n.patch || return 1
+  patch -Np1 -i ../coreutils-6.10-configuration.patch || return 1
   # from gentoo portage
   patch -Np1 -i ../coreutils-uname.patch || return 1
-  # fix compiling against new glibc
-  patch -Np1 -i ../futimes.patch || return 1
   # make head and tail recognize the old syntax (eg, tail -10)
   export DEFAULT_POSIX2_VERSION=199209
-  ./configure --prefix=/usr --enable-pam ac_cv_func_openat=no 
+  ./configure --prefix=/usr ac_cv_func_openat=no --enable-install-program=su
   make || return 1
   make DESTDIR=$startdir/pkg install
   rm -f $startdir/pkg/usr/bin/hostname $startdir/pkg/usr/share/man/man1/hostname.1 || return 1
Index: core/base/coreutils/coreutils-i18n.patch
diff -u core/base/coreutils/coreutils-i18n.patch:1.5 core/base/coreutils/coreutils-i18n.patch:1.6
--- core/base/coreutils/coreutils-i18n.patch:1.5	Sat Mar 24 12:23:27 2007
+++ core/base/coreutils/coreutils-i18n.patch	Sat Feb  2 07:28:16 2008
@@ -16,7 +16,7 @@
 +locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77
 +errors=0
 +
-+$xx -t ? -k2 -n mb1.I > mb1.O
++$xx -t ï¼  -k2 -n mb1.I > mb1.O
 +code=$?
 +if test $code != 0; then
 +  $echo "Test mb1 failed: $xx return code $code differs from expected value 0" 1>&2
@@ -34,7 +34,7 @@
 +  esac
 +fi
 +
-+$xx -t ? -k4 -n mb2.I > mb2.O
++$xx -t ï¼  -k4 -n mb2.I > mb2.O
 +code=$?
 +if test $code != 0; then
 +  $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2
@@ -62,35 +62,35 @@
 --- /dev/null	2007-03-01 09:16:39.219409909 +0000
 +++ coreutils-6.8+/tests/sort/mb2.I	2007-03-01 15:08:24.000000000 +0000
 @@ -0,0 +1,4 @@
-+Apple???10??20
-+Banana???5??30
-+Citrus???20??5
-+Cherry???30??10
++Apple@AA10@@20
++Banana@AA5@@30
++Citrus@AA20@@5
++Cherry@AA30@@10
 --- /dev/null	2007-03-01 09:16:39.219409909 +0000
 +++ coreutils-6.8+/tests/sort/mb2.X	2007-03-01 15:08:24.000000000 +0000
 @@ -0,0 +1,4 @@
-+Citrus???20??5
-+Cherry???30??10
-+Apple???10??20
-+Banana???5??30
++Citrus@AA20@@5
++Cherry@AA30@@10
++Apple@AA10@@20
++Banana@AA5@@30
 --- /dev/null	2007-03-01 09:16:39.219409909 +0000
 +++ coreutils-6.8+/tests/sort/mb1.I	2007-03-01 15:08:24.000000000 +0000
 @@ -0,0 +1,4 @@
-+Apple?10
-+Banana?5
-+Citrus?20
-+Cherry?30
++Appleï¼ 10
++Bananaï¼ 5
++Citrusï¼ 20
++Cherryï¼ 30
 --- /dev/null	2007-03-01 09:16:39.219409909 +0000
 +++ coreutils-6.8+/tests/sort/mb1.X	2007-03-01 15:08:24.000000000 +0000
 @@ -0,0 +1,4 @@
-+Banana?5
-+Apple?10
-+Citrus?20
-+Cherry?30
++Bananaï¼ 5
++Appleï¼ 10
++Citrusï¼ 20
++Cherryï¼ 30
 --- coreutils-6.8+/tests/sort/Makefile.am.i18n	2007-01-24 07:47:37.000000000 +0000
 +++ coreutils-6.8+/tests/sort/Makefile.am	2007-03-01 15:09:59.000000000 +0000
-@@ -66,15 +66,17 @@
- bigfield.O bigfield.E
+@@ -66,12 +66,14 @@
+ bigfield.O bigfield.E obs-inval.O obs-inval.E realloc-buf.O realloc-buf.E
  ##test-files-end
  
 -EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
@@ -99,9 +99,6 @@
 +
 +EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X
 +noinst_SCRIPTS = $x-tests # $x-mb-tests
- TESTS_ENVIRONMENT = \
-   CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
-   PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
  
  editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g'
  
@@ -1096,7 +1093,7 @@
 +	  mbstate_t thisstate;
 +#endif
 +
- 	  if (readlinebuffer (thisline, stdin) == 0)
+ 	  if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
  	    break;
  	  thisfield = find_field (thisline);
  	  thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@@ -1130,7 +1127,7 @@
 +      mbstate_t prevstate;
 +#endif
  
-       if (readlinebuffer (prevline, stdin) == 0)
+       if (readlinebuffer_delim (prevline, stdin, delimiter) == 0)
  	goto closefiles;
        prevfield = find_field (prevline);
        prevlen = prevline->length - 1 - (prevfield - prevline->buffer);
@@ -1146,7 +1143,7 @@
 +#if HAVE_MBRTOWC
 +	  mbstate_t thisstate;
 +#endif
- 	  if (readlinebuffer (thisline, stdin) == 0)
+ 	  if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
  	    {
  	      if (ferror (stdin))
 @@ -341,6 +561,15 @@
@@ -2196,7 +2193,7 @@
  {
    struct keyfield const *key = keylist;
  
-@@ -1875,6 +2265,177 @@
+@@ -1875,6 +2265,179 @@
    return key->reverse ? -diff : diff;
  }
  
@@ -2232,7 +2229,9 @@
 +      size_t lenb = limb <= textb ? 0 : limb - textb;
 +
 +      /* Actually compare the fields. */
-+      if (key->numeric | key->general_numeric)
++      if (key->random)
++        diff = compare_random (texta, lena, textb, lenb);
++      else if (key->numeric | key->general_numeric)
 +	{
 +	  char savea = *lima, saveb = *limb;
 +
@@ -2373,7 +2372,7 @@
 +
  /* Compare two lines A and B, returning negative, zero, or positive
     depending on whether A compares less than, equal to, or greater than B. */
- 
+
 @@ -2744,7 +3305,7 @@
    initialize_exit_failure (SORT_FAILURE);
  
@@ -3610,7 +3609,7 @@
  	  fieldstr++;
  
 @@ -387,14 +464,16 @@
- 	      if (value == 0)
+ 	      if (!rhs_specified)
  		{
  		  /* `n-'.  From `initial' to end of line. */
 -		  eol_range_start = initial;
@@ -3623,7 +3622,7 @@
  		{
  		  /* `m-n' or `-n' (1-n). */
  		  if (value < initial)
--		    FATAL_ERROR (_("invalid byte or field list"));
+-		    FATAL_ERROR (_("invalid decreasing range"));
 +		    FATAL_ERROR (_("invalid byte, character or field list"));
  
  		  /* Is there already a range going to end of line? */
Index: core/base/coreutils/coreutils-pam.patch
diff -u core/base/coreutils/coreutils-pam.patch:1.3 core/base/coreutils/coreutils-pam.patch:1.4
--- core/base/coreutils/coreutils-pam.patch:1.3	Fri Oct 27 09:45:59 2006
+++ core/base/coreutils/coreutils-pam.patch	Sat Feb  2 07:28:16 2008
@@ -1,16 +1,16 @@
---- coreutils-5.92/src/Makefile.am.pam	2005-10-24 17:58:21.000000000 +0100
-+++ coreutils-5.92/src/Makefile.am	2005-10-24 17:58:21.000000000 +0100
-@@ -93,7 +93,7 @@
- 
- uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS)
+--- coreutils-6.7/src/Makefile.am.pam	2006-11-24 21:28:10.000000000 +0000
++++ coreutils-6.7/src/Makefile.am	2007-01-09 17:00:01.000000000 +0000
+@@ -103,7 +103,7 @@
+ # If necessary, add -lm to resolve use of pow in lib/strtod.c.
+ uptime_LDADD = $(LDADD) $(POW_LIB) $(GETLOADAVG_LIBS)
  
 -su_LDADD = $(LDADD) $(LIB_CRYPT)
 +su_LDADD = $(LDADD) $(LIB_CRYPT) @LIB_PAM@
  
- $(PROGRAMS): ../lib/libcoreutils.a
- 
---- coreutils-5.92/src/su.c.pam	2005-10-24 17:58:21.000000000 +0100
-+++ coreutils-5.92/src/su.c	2005-10-24 18:06:22.000000000 +0100
+ dir_LDADD += $(LIB_ACL)
+ ls_LDADD += $(LIB_ACL)
+--- coreutils-6.7/src/su.c.pam	2007-01-09 17:00:01.000000000 +0000
++++ coreutils-6.7/src/su.c	2007-01-09 17:16:43.000000000 +0000
 @@ -38,6 +38,16 @@
     restricts who can su to UID 0 accounts.  RMS considers that to
     be fascist.
@@ -28,7 +28,7 @@
     Compile-time options:
     -DSYSLOG_SUCCESS	Log successful su's (by default, to root) with syslog.
     -DSYSLOG_FAILURE	Log failed su's (by default, to root) with syslog.
-@@ -81,6 +91,15 @@
+@@ -59,6 +69,15 @@
     prototype (returning `int') in <unistd.h>.  */
  #define getusershell _getusershell_sys_proto_
  
@@ -42,9 +42,9 @@
 +#endif /* USE_PAM */
 +
  #include "system.h"
- #include "dirname.h"
+ #include "getpass.h"
  
-@@ -150,7 +169,9 @@
+@@ -128,15 +147,22 @@
  /* The user to become if none is specified.  */
  #define DEFAULT_USER "root"
  
@@ -54,7 +54,6 @@
  char *getusershell ();
  void endusershell ();
  void setusershell ();
-@@ -158,8 +179,13 @@
  
  extern char **environ;
  
@@ -69,7 +68,7 @@
  
  /* The name this program was run with.  */
  char *program_name;
-@@ -248,7 +274,22 @@
+@@ -225,7 +251,26 @@
  }
  #endif
  
@@ -85,6 +84,10 @@
 +  pam_end(pamh, PAM_SUCCESS); \
 +  return 0; \
 +}
++#define PAM_BAIL_P_VOID if (retval) {		\
++  pam_end(pamh, PAM_SUCCESS);			\
++return;						\
++}
 +#endif
 +
  /* Ask the user for a password.
@@ -92,7 +95,7 @@
     Return true if the user gives the correct password for entry PW,
     false if not.  Return true without asking for a password if run by UID 0
     or if PW has an empty password.  */
-@@ -256,6 +297,44 @@
+@@ -233,6 +278,44 @@
  static bool
  correct_password (const struct passwd *pw)
  {
@@ -137,7 +140,7 @@
    char *unencrypted, *encrypted, *correct;
  #if HAVE_GETSPNAM && HAVE_STRUCT_SPWD_SP_PWDP
    /* Shadow passwd stuff for SVR3 and maybe other systems.  */
-@@ -280,6 +359,7 @@
+@@ -257,6 +340,7 @@
    encrypted = crypt (unencrypted, correct);
    memset (unencrypted, 0, strlen (unencrypted));
    return STREQ (encrypted, correct);
@@ -145,7 +148,7 @@
  }
  
  /* Update `environ' for the new shell based on PW, with SHELL being
-@@ -293,12 +373,18 @@
+@@ -270,12 +354,18 @@
        /* Leave TERM unchanged.  Set HOME, SHELL, USER, LOGNAME, PATH.
           Unset all other environment variables.  */
        char const *term = getenv ("TERM");
@@ -164,7 +167,7 @@
        xsetenv ("HOME", pw->pw_dir);
        xsetenv ("SHELL", shell);
        xsetenv ("USER", pw->pw_name);
-@@ -331,8 +417,13 @@
+@@ -308,8 +398,13 @@
  {
  #ifdef HAVE_INITGROUPS
    errno = 0;
@@ -174,13 +177,13 @@
 +    pam_close_session(pamh, 0);
 +    pam_end(pamh, PAM_ABORT);
 +#endif
-     error (EXIT_FAIL, errno, _("cannot set groups"));
+     error (EXIT_FAILURE, errno, _("cannot set groups"));
 +  }
    endgrent ();
  #endif
    if (setgid (pw->pw_gid))
-@@ -341,6 +432,31 @@
-     error (EXIT_FAIL, errno, _("cannot set user id"));
+@@ -318,6 +413,31 @@
+     error (EXIT_FAILURE, errno, _("cannot set user id"));
  }
  
 +#ifdef USE_PAM
@@ -211,7 +214,7 @@
  /* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
     If COMMAND is nonzero, pass it to the shell with the -c option.
     Pass ADDITIONAL_ARGS to the shell as more arguments; there
-@@ -348,17 +464,49 @@
+@@ -325,17 +445,49 @@
  
  static void
  run_shell (char const *shell, char const *command, char **additional_args,
@@ -262,7 +265,7 @@
        shell_basename = last_component (shell);
        arg0 = xmalloc (strlen (shell_basename) + 2);
        arg0[0] = '-';
-@@ -383,6 +531,66 @@
+@@ -360,6 +512,66 @@
      error (0, errno, "%s", shell);
      exit (exit_status);
    }
@@ -315,9 +318,9 @@
 +  /* Not checking retval on this because we need to call close session */
 +  pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
 +  retval = pam_close_session(pamh, 0);
-+  PAM_BAIL_P;
++  PAM_BAIL_P_VOID;
 +  retval = pam_end(pamh, PAM_SUCCESS);
-+  PAM_BAIL_P;
++  PAM_BAIL_P_VOID;
 +  if (caught) {
 +    sleep(2);
 +    kill(child, SIGKILL);
@@ -329,24 +332,74 @@
  }
  
  /* Return true if SHELL is a restricted shell (one not returned by
-@@ -550,9 +758,11 @@
+@@ -527,9 +739,9 @@
    shell = xstrdup (shell ? shell : pw->pw_shell);
    modify_environment (pw, shell);
  
 +#ifndef USE_PAM
    change_identity (pw);
+-  if (simulate_login && chdir (pw->pw_dir) != 0)
+-    error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
 +#endif
-   if (simulate_login && chdir (pw->pw_dir) != 0)
-     error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
  
 -  run_shell (shell, command, argv + optind, MAX (0, argc - optind));
 +  run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw);
  }
---- coreutils-5.92/configure.ac.pam	2005-10-24 17:58:21.000000000 +0100
-+++ coreutils-5.92/configure.ac	2005-10-24 17:58:21.000000000 +0100
-@@ -28,6 +28,13 @@
- AB_INIT()
- AM_INIT_AUTOMAKE([1.9.6 gnits dist-bzip2])
+--- coreutils-6.7/doc/coreutils.texi.pam	2006-10-27 15:30:48.000000000 +0100
++++ coreutils-6.7/doc/coreutils.texi	2007-01-09 17:00:01.000000000 +0000
+@@ -13395,8 +13395,11 @@
+ @findex syslog
+ @command{su} can optionally be compiled to use @code{syslog} to report
+ failed, and optionally successful, @command{su} attempts.  (If the system
+-supports @code{syslog}.)  However, GNU @command{su} does not check if the
+-user is a member of the @code{wheel} group; see below.
++supports @code{syslog}.)
++
++This version of @command{su} has support for using PAM for
++authentication.  You can edit @file{/etc/pam.d/su} to customize its
++behaviour.
+ 
+ The program accepts the following options.  Also see @ref{Common options}.
+ 
+@@ -13477,33 +13480,6 @@
+ the exit status of the subshell otherwise
+ @end display
+ 
+- at cindex wheel group, not supported
+- at cindex group wheel, not supported
+- at cindex fascism
+- at subsection Why GNU @command{su} does not support the @samp{wheel} group
+-
+-(This section is by Richard Stallman.)
+-
+- at cindex Twenex
+- at cindex MIT AI lab
+-Sometimes a few of the users try to hold total power over all the
+-rest.  For example, in 1984, a few users at the MIT AI lab decided to
+-seize power by changing the operator password on the Twenex system and
+-keeping it secret from everyone else.  (I was able to thwart this coup
+-and give power back to the users by patching the kernel, but I
+-wouldn't know how to do that in Unix.)
+-
+-However, occasionally the rulers do tell someone.  Under the usual
+- at command{su} mechanism, once someone learns the root password who
+-sympathizes with the ordinary users, he or she can tell the rest.  The
+-``wheel group'' feature would make this impossible, and thus cement the
+-power of the rulers.
+-
+-I'm on the side of the masses, not that of the rulers.  If you are
+-used to supporting the bosses and sysadmins in whatever they do, you
+-might find this idea strange at first.
+-
+-
+ @node Process control
+ @chapter Process control
+ 
+--- coreutils-6.7/configure.ac.pam	2006-12-07 21:30:24.000000000 +0000
++++ coreutils-6.7/configure.ac	2007-01-09 17:18:04.000000000 +0000
+@@ -44,6 +44,13 @@
+ gl_INIT
+ coreutils_MACROS
  
 +dnl Give the chance to enable PAM
 +AC_ARG_ENABLE(pam, dnl
@@ -355,18 +408,6 @@
 +LIB_PAM="-ldl -lpam -lpam_misc"
 +AC_SUBST(LIB_PAM)])
 +
- AC_PROG_CC_STDC
- AM_PROG_CC_C_O
- AC_PROG_CPP
---- coreutils-5.92/lib/config.hin.pam	2005-10-24 17:58:21.000000000 +0100
-+++ coreutils-5.92/lib/config.hin	2005-10-24 17:58:21.000000000 +0100
-@@ -1526,6 +1526,9 @@
- /* Define if you want access control list support. */
- #undef USE_ACL
- 
-+/* Define if you want to use PAM */
-+#undef USE_PAM
-+
- /* Version number of package */
- #undef VERSION
- 
+ AC_FUNC_FORK
+
+ optional_bin_progs=
Index: core/base/coreutils/coreutils-uname.patch
diff -u core/base/coreutils/coreutils-uname.patch:1.2 core/base/coreutils/coreutils-uname.patch:1.3
--- core/base/coreutils/coreutils-uname.patch:1.2	Sat Jun 24 03:42:02 2006
+++ core/base/coreutils/coreutils-uname.patch	Sat Feb  2 07:28:16 2008
@@ -23,7 +23,7 @@
  #include "system.h"
  #include "error.h"
  #include "quote.h"
-@@ -138,6 +143,95 @@ Print certain system information.  With 
+@@ -138,6 +143,117 @@
    exit (status);
  }
  
@@ -31,13 +31,13 @@
 +
 +# if defined(__s390__) || defined(__s390x__)
 +#  define CPUINFO_FILE    "/proc/sysinfo"
-+#  define CPUINFO_FORMAT  "%[^\t :]%*[ :]%[^\n]\n"
++#  define CPUINFO_FORMAT  "%64[^\t :]%*[ :]%256[^\n]%c"
 +# else
 +#  define CPUINFO_FILE    "/proc/cpuinfo"
-+#  define CPUINFO_FORMAT  "%[^\t:]\t:%[^\n]\n"
++#  define CPUINFO_FORMAT  "%64[^\t:]\t:%256[^\n]%c"
 +# endif
 +
-+# define PROCINFO_ARCHITECTURE      0
++# define PROCINFO_PROCESSOR      0
 +# define PROCINFO_HARDWARE_PLATFORM 1
 +
 +static void __eat_cpuinfo_space(char *buf)
@@ -49,9 +49,18 @@
 +	/* then eat leading space */
 +	tmp = buf;
 +	while (*tmp && isspace(*tmp))
-+		*tmp++;
++		tmp++;
 +	if (tmp != buf)
 +		memmove(buf, tmp, strlen(tmp)+1);
++	/* finally collapse whitespace */
++	tmp = buf;
++	while (tmp[0] && tmp[1]) {
++		if (isspace(tmp[0]) && isspace(tmp[1])) {
++			memmove(tmp, tmp+1, strlen(tmp));
++			continue;
++		}
++		++tmp;
++	}
 +}
 +
 +static int __linux_procinfo (int x, char *fstr, size_t s)
@@ -59,49 +68,62 @@
 +	FILE *fp;
 +
 +	char *procinfo_keys[] = {
-+		#if defined(__i386__) || defined(__x86_64__)
++		/* --processor --hardware-platform */
++		#if defined(__alpha__)
++			"cpu model", "system type"
++		#elif defined(__arm__)
++			"Processor", "Hardware"
++		#elif defined(__avr32__)
++			"processor", "cpu family"
++		#elif defined(__bfin__)
++			"CPU", "BOARD Name"
++		#elif defined(__cris__)
++			"cpu", "cpu model"
++		#elif defined(__frv__)
++			"CPU-Core", "System"
++		#elif defined(__i386__) || defined(__x86_64__)
 +			"model name", "vendor_id"
 +		#elif defined(__ia64__)
 +			"family", "vendor"
-+		#elif defined(__alpha__)
-+			"cpu model", "system type"
-+		#elif defined(sparc) || defined(__sparc__)
-+			"type", "cpu"
 +		#elif defined(__hppa__)
 +			"cpu", "model"
++		#elif defined(__m68k__)
++			"CPU", "MMU"
 +		#elif defined(__mips__)
 +			"cpu model", "system type"
 +		#elif defined(__powerpc__) || defined(__powerpc64__)
 +			"cpu", "machine"
-+		#elif defined(__arm__)
-+			"Processor", "Hardware"
 +		#elif defined(__s390__) || defined(__s390x__)
 +			"Type", "Manufacturer"
 +		#elif defined(__sh__)
-+			"cpu family", "machine"
-+		#elif defined(__m68k__)
-+			"CPU", "MMU"
-+		#elif defined(__cris__)
-+			"cpu", "cpu model"
-+		#elif defined(__frv__)
-+			"CPU-Core", "System"
-+		#elif defined(bfin)
-+			"CPU", "BOARD Name"
++			"cpu type", "machine"
++		#elif defined(sparc) || defined(__sparc__)
++			"type", "cpu"
++		#elif defined(__vax__)
++			"cpu type", "cpu"
 +		#else
 +			"unknown", "unknown"
 +		#endif
 +	};
 +
 +	if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
-+		char key[64], value[257], *ret = NULL;
++		char key[65], value[257], eol, *ret = NULL;
 +
-+		while (fscanf(fp, CPUINFO_FORMAT, key, value) != EOF) {
++		while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
 +			__eat_cpuinfo_space(key);
 +			if (!strcmp(key, procinfo_keys[x])) {
 +				__eat_cpuinfo_space(value);
 +				ret = value;
 +				break;
 +			}
++			if (eol != '\n') {
++				/* we need two fscanf's here in case the previous
++				 * length limit caused us to read right up to the
++				 * newline ... doing "%*[^\n]\n" wont eat the newline
++				 */
++				fscanf(fp, "%*[^\n]");
++				fscanf(fp, "\n");
++			}
 +		}
 +		fclose(fp);
 +
@@ -128,7 +150,7 @@
        {
  	static char processor[257];
 +#if defined(USE_PROCINFO)
-+	if (0 <= __linux_procinfo (PROCINFO_ARCHITECTURE, processor, sizeof processor))
++	if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
 +#else
  	if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
 +#endif




More information about the arch-commits mailing list