coreutils/coreutils-sysinfo.patch
Bernhard Voelker 6f150a9022 Accepting request 213254 from home:bernhard-voelker
- Add upstream patch (coreutils-copy-fix-selinux-existing-dirs.patch):
  cp -a: set the correct SELinux context on already existing
  destination directories (rh#1045122).

- Merge I18n fixes from Fedora (coreutils-i18n.patch):
  * sort: fix sorting by non-first field (rh#1003544)
  * cut: avoid using slower multi-byte code in non-UTF-8 locales
    (rh#1021403, rh#499220).

- Testsuite: skip some tests:
  * coreutils-skip-some-sort-tests-on-ppc.patch: Add patch to
    skip 2 valgrind'ed sort tests on ppc/ppc64.
  * coreutils-skip-gnulib-test-tls.patch: Add patch to skip
    the gnulib test 'test-tls' on i586, x86_64, ppc and ppc64.
  * coreutils-tests-avoid-FP-cp-cpuinfo.patch: Add patch to skip a
    test when cp fails for /proc/cpuinfo which happens on aarch64.
  * coreutils-tests-shorten-extreme-factor-tests.patch: Add patch
    to skip most of the extreme-expensive factor tests.

OBS-URL: https://build.opensuse.org/request/show/213254
OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=221
2014-01-09 02:21:45 +00:00

65 lines
1.8 KiB
Diff

---
src/uname.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
Index: src/uname.c
===================================================================
--- src/uname.c.orig 2013-12-04 15:48:30.000000000 +0100
+++ src/uname.c 2014-01-09 01:26:27.130914660 +0100
@@ -337,6 +337,36 @@ main (int argc, char **argv)
# endif
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char processor[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (processor, name.machine);
+ element = processor;
+#ifdef __linux__
+ if (!strcmp (element, "i686"))
+ {
+ /* Check for Athlon */
+ char line[1024];
+ FILE *f = fopen ("/proc/cpuinfo", "r");
+ if (f)
+ {
+ while (fgets (line, sizeof (line), f) > 0)
+ {
+ if (strncmp (line, "vendor_id", 9) == 0)
+ {
+ if (strstr (line, "AuthenticAMD"))
+ element = "athlon";
+ break;
+ }
+ }
+ fclose (f);
+ }
+ }
+#endif
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}
@@ -362,6 +392,18 @@ main (int argc, char **argv)
element = hardware_platform;
}
#endif
+ if (element == unknown)
+ {
+ struct utsname name;
+ static char hardware_platform[sizeof (name.machine)];
+ if (uname (&name) != 0)
+ error (EXIT_FAILURE, errno, _("cannot get system name"));
+ strcpy (hardware_platform, name.machine);
+ if (hardware_platform[0] == 'i' && hardware_platform[2] == '8'
+ && hardware_platform[3] == '6' && hardware_platform[4] == 0)
+ hardware_platform[1] = '3';
+ element = hardware_platform;
+ }
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}