CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
coreutils: updated to 8.32
authorVictor Martinez <pitillo@ono.com>
Tue, 11 Aug 2020 18:18:23 +0000 (20:18 +0200)
committerVictor Martinez <pitillo@ono.com>
Tue, 11 Aug 2020 18:18:23 +0000 (20:18 +0200)
coreutils/.footprint [new file with mode: 0644]
coreutils/.signature [new file with mode: 0644]
coreutils/Pkgfile [new file with mode: 0644]
coreutils/arch_patch.patch [new file with mode: 0644]
coreutils/coreutils-uname.patch [new file with mode: 0644]

diff --git a/coreutils/.footprint b/coreutils/.footprint
new file mode 100644 (file)
index 0000000..bfdf2cf
--- /dev/null
@@ -0,0 +1,210 @@
+drwxr-xr-x     root/root       bin/
+-rwxr-xr-x     root/root       bin/cat
+-rwxr-xr-x     root/root       bin/chgrp
+-rwxr-xr-x     root/root       bin/chmod
+-rwxr-xr-x     root/root       bin/chown
+-rwxr-xr-x     root/root       bin/cp
+-rwxr-xr-x     root/root       bin/date
+-rwxr-xr-x     root/root       bin/dd
+-rwxr-xr-x     root/root       bin/df
+-rwxr-xr-x     root/root       bin/echo
+-rwxr-xr-x     root/root       bin/false
+-rwxr-xr-x     root/root       bin/ln
+-rwxr-xr-x     root/root       bin/ls
+-rwxr-xr-x     root/root       bin/mkdir
+-rwxr-xr-x     root/root       bin/mknod
+-rwxr-xr-x     root/root       bin/mv
+-rwxr-xr-x     root/root       bin/pwd
+-rwxr-xr-x     root/root       bin/readlink
+-rwxr-xr-x     root/root       bin/rm
+-rwxr-xr-x     root/root       bin/rmdir
+-rwxr-xr-x     root/root       bin/sleep
+-rwxr-xr-x     root/root       bin/stty
+-rwxr-xr-x     root/root       bin/sync
+-rwxr-xr-x     root/root       bin/touch
+-rwxr-xr-x     root/root       bin/true
+-rwxr-xr-x     root/root       bin/uname
+drwxr-xr-x     root/root       usr/
+drwxr-xr-x     root/root       usr/bin/
+-rwxr-xr-x     root/root       usr/bin/[
+-rwxr-xr-x     root/root       usr/bin/b2sum
+-rwxr-xr-x     root/root       usr/bin/base32
+-rwxr-xr-x     root/root       usr/bin/base64
+-rwxr-xr-x     root/root       usr/bin/basename
+-rwxr-xr-x     root/root       usr/bin/basenc
+-rwxr-xr-x     root/root       usr/bin/chroot
+-rwxr-xr-x     root/root       usr/bin/cksum
+-rwxr-xr-x     root/root       usr/bin/comm
+-rwxr-xr-x     root/root       usr/bin/csplit
+-rwxr-xr-x     root/root       usr/bin/cut
+-rwxr-xr-x     root/root       usr/bin/dir
+-rwxr-xr-x     root/root       usr/bin/dircolors
+-rwxr-xr-x     root/root       usr/bin/dirname
+-rwxr-xr-x     root/root       usr/bin/du
+-rwxr-xr-x     root/root       usr/bin/env
+-rwxr-xr-x     root/root       usr/bin/expand
+-rwxr-xr-x     root/root       usr/bin/expr
+-rwxr-xr-x     root/root       usr/bin/factor
+-rwxr-xr-x     root/root       usr/bin/fmt
+-rwxr-xr-x     root/root       usr/bin/fold
+-rwxr-xr-x     root/root       usr/bin/head
+-rwxr-xr-x     root/root       usr/bin/hostid
+-rwxr-xr-x     root/root       usr/bin/id
+-rwxr-xr-x     root/root       usr/bin/install
+-rwxr-xr-x     root/root       usr/bin/join
+-rwxr-xr-x     root/root       usr/bin/link
+-rwxr-xr-x     root/root       usr/bin/logname
+-rwxr-xr-x     root/root       usr/bin/md5sum
+-rwxr-xr-x     root/root       usr/bin/mkfifo
+-rwxr-xr-x     root/root       usr/bin/mktemp
+-rwxr-xr-x     root/root       usr/bin/nice
+-rwxr-xr-x     root/root       usr/bin/nl
+-rwxr-xr-x     root/root       usr/bin/nohup
+-rwxr-xr-x     root/root       usr/bin/nproc
+-rwxr-xr-x     root/root       usr/bin/numfmt
+-rwxr-xr-x     root/root       usr/bin/od
+-rwxr-xr-x     root/root       usr/bin/paste
+-rwxr-xr-x     root/root       usr/bin/pathchk
+-rwxr-xr-x     root/root       usr/bin/pinky
+-rwxr-xr-x     root/root       usr/bin/pr
+-rwxr-xr-x     root/root       usr/bin/printenv
+-rwxr-xr-x     root/root       usr/bin/printf
+-rwxr-xr-x     root/root       usr/bin/ptx
+-rwxr-xr-x     root/root       usr/bin/realpath
+-rwxr-xr-x     root/root       usr/bin/seq
+-rwxr-xr-x     root/root       usr/bin/sha1sum
+-rwxr-xr-x     root/root       usr/bin/sha224sum
+-rwxr-xr-x     root/root       usr/bin/sha256sum
+-rwxr-xr-x     root/root       usr/bin/sha384sum
+-rwxr-xr-x     root/root       usr/bin/sha512sum
+-rwxr-xr-x     root/root       usr/bin/shred
+-rwxr-xr-x     root/root       usr/bin/shuf
+-rwxr-xr-x     root/root       usr/bin/sort
+-rwxr-xr-x     root/root       usr/bin/split
+-rwxr-xr-x     root/root       usr/bin/stat
+-rwxr-xr-x     root/root       usr/bin/stdbuf
+-rwxr-xr-x     root/root       usr/bin/sum
+-rwxr-xr-x     root/root       usr/bin/tac
+-rwxr-xr-x     root/root       usr/bin/tail
+-rwxr-xr-x     root/root       usr/bin/tee
+-rwxr-xr-x     root/root       usr/bin/test
+-rwxr-xr-x     root/root       usr/bin/timeout
+-rwxr-xr-x     root/root       usr/bin/tr
+-rwxr-xr-x     root/root       usr/bin/truncate
+-rwxr-xr-x     root/root       usr/bin/tsort
+-rwxr-xr-x     root/root       usr/bin/tty
+-rwxr-xr-x     root/root       usr/bin/unexpand
+-rwxr-xr-x     root/root       usr/bin/uniq
+-rwxr-xr-x     root/root       usr/bin/unlink
+-rwxr-xr-x     root/root       usr/bin/users
+-rwxr-xr-x     root/root       usr/bin/vdir
+-rwxr-xr-x     root/root       usr/bin/wc
+-rwxr-xr-x     root/root       usr/bin/who
+-rwxr-xr-x     root/root       usr/bin/whoami
+-rwxr-xr-x     root/root       usr/bin/yes
+drwxr-xr-x     root/root       usr/lib/
+drwxr-xr-x     root/root       usr/lib/coreutils/
+-rwxr-xr-x     root/root       usr/lib/coreutils/libstdbuf.so
+drwxr-xr-x     root/root       usr/share/
+drwxr-xr-x     root/root       usr/share/man/
+drwxr-xr-x     root/root       usr/share/man/man1/
+-rw-r--r--     root/root       usr/share/man/man1/b2sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/base32.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/base64.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/basename.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/basenc.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/cat.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/chgrp.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/chmod.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/chown.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/chroot.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/cksum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/comm.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/cp.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/csplit.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/cut.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/date.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/dd.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/df.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/dir.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/dircolors.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/dirname.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/du.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/echo.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/env.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/expand.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/expr.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/factor.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/false.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/fmt.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/fold.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/head.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/hostid.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/id.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/install.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/join.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/link.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/ln.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/logname.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/ls.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/md5sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/mkdir.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/mkfifo.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/mknod.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/mktemp.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/mv.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/nice.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/nl.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/nohup.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/nproc.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/numfmt.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/od.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/paste.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/pathchk.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/pinky.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/pr.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/printenv.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/printf.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/ptx.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/pwd.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/readlink.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/realpath.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/rm.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/rmdir.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/seq.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sha1sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sha224sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sha256sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sha384sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sha512sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/shred.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/shuf.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sleep.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sort.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/split.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/stat.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/stdbuf.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/stty.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sum.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/sync.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/tac.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/tail.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/tee.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/test.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/timeout.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/touch.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/tr.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/true.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/truncate.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/tsort.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/tty.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/uname.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/unexpand.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/uniq.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/unlink.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/users.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/vdir.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/wc.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/who.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/whoami.1.gz
+-rw-r--r--     root/root       usr/share/man/man1/yes.1.gz
diff --git a/coreutils/.signature b/coreutils/.signature
new file mode 100644 (file)
index 0000000..d31b9c1
--- /dev/null
@@ -0,0 +1,7 @@
+untrusted comment: verify with /etc/ports/core-arm64.pub
+RWSKslkvIwb+2cbbgdOOEOsto124MBp0kXJwKsurA0mpZMcQa5Amg7sQOXKqWqmAzFi3UNcTkzSPJEvH5s7cagAMt3iM/Ni/OAI=
+SHA256 (Pkgfile) = 79a57d961850d9a10eddd9b10e8fc0792b0ccf915c246ea7f64b4554edd3cf48
+SHA256 (.footprint) = 45c2d1805ada036f538df41d4f15b3148670d9247839effbc39276b9d0c37819
+SHA256 (coreutils-8.32.tar.xz) = 4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa
+SHA256 (coreutils-uname.patch) = 164ad5976c67dd49f1d28d3124a6cb5395d52a23d9a3112a10a795af6069d97d
+SHA256 (arch_patch.patch) = ee8ddb4e04d89089ba6022dcc736e145cf3149f8c317d3ea114485605060fe83
diff --git a/coreutils/Pkgfile b/coreutils/Pkgfile
new file mode 100644 (file)
index 0000000..e1e1444
--- /dev/null
@@ -0,0 +1,34 @@
+# Description: A collection of core GNU utilities
+# URL: http://www.gnu.org/software/coreutils/
+# Maintainer: CRUX System Team, core-ports at crux dot nu
+# Arch Maintainer: CRUX-ARM System Team, devel at crux-arm dot nu
+# Depends on: libgmp acl libcap
+
+name=coreutils
+version=8.32
+release=1
+source=(http://ftpmirror.gnu.org/gnu/$name/$name-$version.tar.xz
+        coreutils-uname.patch
+        arch_patch.patch)
+
+build() {
+  cd $name-$version
+
+  patch -p1 -i $SRC/coreutils-uname.patch
+  patch -p1 -i $SRC/arch_patch.patch
+
+  export FORCE_UNSAFE_CONFIGURE=1
+    
+  ./configure --prefix=/usr \
+              --libexecdir=/usr/lib \
+              --disable-nls \
+              --disable-assert \
+              --enable-no-install-program=uptime,kill,chcon,runcon,groups
+  make
+  make DESTDIR=$PKG install 
+
+  install -d $PKG/bin
+  mv $PKG/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo,false,ln,ls,mkdir,sleep} $PKG/bin
+  mv $PKG/usr/bin/{mknod,mv,pwd,readlink,rm,rmdir,stty,sync,touch,true,uname} $PKG/bin
+  rm -r $PKG/usr/share/info
+}
diff --git a/coreutils/arch_patch.patch b/coreutils/arch_patch.patch
new file mode 100644 (file)
index 0000000..42e78b7
--- /dev/null
@@ -0,0 +1,114 @@
+From 10fcb97bd728f09d4a027eddf8ad2900f0819b0a Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Thu, 5 Mar 2020 17:25:29 -0800
+Subject: [PATCH] ls: restore 8.31 behavior on removed directories
+
+* NEWS: Mention this.
+* src/ls.c: Do not include <sys/sycall.h>
+(print_dir): Don't worry about whether the directory is removed.
+* tests/ls/removed-directory.sh: Adjust to match new (i.e., old)
+behavior.
+---
+ NEWS                          |  6 ++++++
+ src/ls.c                      | 22 ----------------------
+ tests/ls/removed-directory.sh | 10 ++--------
+ 3 files changed, 8 insertions(+), 30 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index fdc8bf5db..653e7178b 100644
+--- a/NEWS
++++ b/NEWS
+@@ -2,6 +2,12 @@ GNU coreutils NEWS                                    -*- outline -*-
+ * Noteworthy changes in release ?.? (????-??-??) [?]
++** Changes in behavior
++
++  On GNU/Linux systems, ls no longer issues an error message on
++  directory merely because it was removed.  This reverts a change
++  that was made in release 8.32.
++
+ * Noteworthy changes in release 8.32 (2020-03-05) [stable]
+diff --git a/src/ls.c b/src/ls.c
+index 24b983287..4acf5f44d 100644
+--- a/src/ls.c
++++ b/src/ls.c
+@@ -49,10 +49,6 @@
+ # include <sys/ptem.h>
+ #endif
+-#ifdef __linux__
+-# include <sys/syscall.h>
+-#endif
+-
+ #include <stdio.h>
+ #include <assert.h>
+ #include <setjmp.h>
+@@ -2896,7 +2892,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+   struct dirent *next;
+   uintmax_t total_blocks = 0;
+   static bool first = true;
+-  bool found_any_entries = false;
+   errno = 0;
+   dirp = opendir (name);
+@@ -2972,7 +2967,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+       next = readdir (dirp);
+       if (next)
+         {
+-          found_any_entries = true;
+           if (! file_ignored (next->d_name))
+             {
+               enum filetype type = unknown;
+@@ -3018,22 +3012,6 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
+           if (errno != EOVERFLOW)
+             break;
+         }
+-#ifdef __linux__
+-      else if (! found_any_entries)
+-        {
+-          /* If readdir finds no directory entries at all, not even "." or
+-             "..", then double check that the directory exists.  */
+-          if (syscall (SYS_getdents, dirfd (dirp), NULL, 0) == -1
+-              && errno != EINVAL)
+-            {
+-              /* We exclude EINVAL as that pertains to buffer handling,
+-                 and we've passed NULL as the buffer for simplicity.
+-                 ENOENT is returned if appropriate before buffer handling.  */
+-              file_failure (command_line_arg, _("reading directory %s"), name);
+-            }
+-          break;
+-        }
+-#endif
+       else
+         break;
+diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
+index e8c835dab..fe8f929a1 100755
+--- a/tests/ls/removed-directory.sh
++++ b/tests/ls/removed-directory.sh
+@@ -26,20 +26,14 @@ case $host_triplet in
+   *) skip_ 'non linux kernel' ;;
+ esac
+-LS_FAILURE=2
+-
+-cat <<\EOF >exp-err || framework_failure_
+-ls: reading directory '.': No such file or directory
+-EOF
+-
+ cwd=$(pwd)
+ mkdir d || framework_failure_
+ cd d || framework_failure_
+ rmdir ../d || framework_failure_
+-returns_ $LS_FAILURE ls >../out 2>../err || fail=1
++ls >../out 2>../err || fail=1
+ cd "$cwd" || framework_failure_
+ compare /dev/null out || fail=1
+-compare exp-err err || fail=1
++compare /dev/null err || fail=1
+ Exit $fail
diff --git a/coreutils/coreutils-uname.patch b/coreutils/coreutils-uname.patch
new file mode 100644 (file)
index 0000000..37f4729
--- /dev/null
@@ -0,0 +1,176 @@
+# http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/7.5/
+
+On linux platforms, grok /proc/cpuinfo for the CPU/vendor info.
+
+Prob not suitable for upstream seeing as how it's 100% linux-specific
+http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
+
+Patch originally by Carlos E. Gorges <carlos@techlinux.com.br>, but 
+heavily reworked to suck less.
+
+To add support for additional platforms, check out the show_cpuinfo()
+func in the linux/arch/<ARCH>/ source tree of the kernel.
+
+diff -Nru coreutils-7.6.orig/src/uname.c coreutils-7.6/src/uname.c
+--- coreutils-7.6.orig/src/uname.c     2009-09-11 16:34:48.000000000 +0200
++++ coreutils-7.6/src/uname.c  2009-09-11 16:40:29.000000000 +0200
+@@ -50,6 +50,11 @@
+ # include <mach-o/arch.h>
+ #endif
++#if defined(__linux__)
++# define USE_PROCINFO
++# define UNAME_HARDWARE_PLATFORM
++#endif
++
+ #include "system.h"
+ #include "error.h"
+ #include "quote.h"
+@@ -155,6 +160,117 @@
+   exit (status);
+ }
++#if defined(USE_PROCINFO)
++
++# if defined(__s390__) || defined(__s390x__)
++#  define CPUINFO_FILE    "/proc/sysinfo"
++#  define CPUINFO_FORMAT  "%64[^\t :]%*[ :]%256[^\n]%c"
++# else
++#  define CPUINFO_FILE    "/proc/cpuinfo"
++#  define CPUINFO_FORMAT  "%64[^\t:]\t:%256[^\n]%c"
++# endif
++
++# define PROCINFO_PROCESSOR      0
++# define PROCINFO_HARDWARE_PLATFORM 1
++
++static void __eat_cpuinfo_space(char *buf)
++{
++      /* first eat trailing space */
++      char *tmp = buf + strlen(buf) - 1;
++      while (tmp > buf && isspace(*tmp))
++              *tmp-- = '\0';
++      /* then eat leading space */
++      tmp = buf;
++      while (*tmp && isspace(*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)
++{
++      FILE *fp;
++
++      char *procinfo_keys[] = {
++              /* --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(__hppa__)
++                      "cpu", "model"
++              #elif defined(__m68k__)
++                      "CPU", "MMU"
++              #elif defined(__mips__)
++                      "cpu model", "system type"
++              #elif defined(__powerpc__) || defined(__powerpc64__)
++                      "cpu", "machine"
++              #elif defined(__s390__) || defined(__s390x__)
++                      "Type", "Manufacturer"
++              #elif defined(__sh__)
++                      "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[65], value[257], eol, *ret = NULL;
++
++              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);
++
++              if (ret) {
++                      strncpy(fstr, ret, s);
++                      return 0;
++              }
++      }
++
++      return -1;
++}
++
++#endif
++
+ /* Print ELEMENT, preceded by a space if something has already been
+    printed.  */
+@@ -302,10 +418,14 @@
+   if (toprint & PRINT_PROCESSOR)
+     {
+       char const *element = unknown;
+-#if HAVE_SYSINFO && defined SI_ARCHITECTURE
++#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO)
+       {
+         static char processor[257];
++#if defined(USE_PROCINFO)
++      if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
++#else
+         if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
++#endif
+           element = processor;
+       }
+ #endif
+@@ -358,9 +478,13 @@
+       if (element == unknown)
+         {
+           static char hardware_platform[257];
++#if defined(USE_PROCINFO)
++        if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
++#else
+           size_t s = sizeof hardware_platform;
+           static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
+           if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
++#endif
+             element = hardware_platform;
+         }
+ #endif