coreutils/coreutils-sysinfo.patch

65 lines
1.8 KiB
Diff
Raw Normal View History

---
src/uname.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
Index: src/uname.c
===================================================================
--- src/uname.c.orig
+++ src/uname.c
- gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct directory; broken in 9.1. See https://bugs.gnu.org/55029 - update to 9.1: * chmod -R no longer exits with error status when encountering symlinks. All files would be processed correctly, but the exit status was incorrect. * If 'cp -Z A B' checks B's status and some other process then removes B, cp no longer creates B with a too-generous SELinux security context before adjusting it to the correct value. * 'cp --preserve=ownership A B' no longer ignores the umask when creating B. Also, 'cp --preserve-xattr A B' is less likely to temporarily chmod u+w B. * 'id xyz' now uses the name 'xyz' to determine groups, instead of xyz's uid. * 'ls -v' and 'sort -V' no longer mishandle corner cases like "a..a" vs "a.+" or lines containing NULs. Their behavior now matches the documentation for file names like ".m4" that consist entirely of an extension, and the documentation has been clarified for unusual cases. * 'mv -T --backup=numbered A B/' no longer miscalculates the backup number for B when A is a directory, possibly inflooping. * cat now uses the copy_file_range syscall if available, when doing simple copies between regular files. This may be more efficient, by avoiding user space copies, and possibly employing copy offloading or reflinking. * chown and chroot now warn about usages like "chown root.root f", which have the nonstandard and long-obsolete "." separator that causes problems on platforms where user names contain ".". Applications should use ":" instead of ".". * cksum no longer allows abbreviated algorithm names, so that forward compatibility and robustness is improved. * date +'%-N' now suppresses excess trailing digits, instead of always padding them with zeros to 9 digits. It uses clock_getres and clock_gettime to infer the clock resolution. OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=328
2022-04-26 10:21:31 +02:00
@@ -341,6 +341,36 @@ main (int argc, char **argv)
element = processor;
}
#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);
}
- gnulib-simple-backup-fix.patch: Add patch to make simple backups in correct directory; broken in 9.1. See https://bugs.gnu.org/55029 - update to 9.1: * chmod -R no longer exits with error status when encountering symlinks. All files would be processed correctly, but the exit status was incorrect. * If 'cp -Z A B' checks B's status and some other process then removes B, cp no longer creates B with a too-generous SELinux security context before adjusting it to the correct value. * 'cp --preserve=ownership A B' no longer ignores the umask when creating B. Also, 'cp --preserve-xattr A B' is less likely to temporarily chmod u+w B. * 'id xyz' now uses the name 'xyz' to determine groups, instead of xyz's uid. * 'ls -v' and 'sort -V' no longer mishandle corner cases like "a..a" vs "a.+" or lines containing NULs. Their behavior now matches the documentation for file names like ".m4" that consist entirely of an extension, and the documentation has been clarified for unusual cases. * 'mv -T --backup=numbered A B/' no longer miscalculates the backup number for B when A is a directory, possibly inflooping. * cat now uses the copy_file_range syscall if available, when doing simple copies between regular files. This may be more efficient, by avoiding user space copies, and possibly employing copy offloading or reflinking. * chown and chroot now warn about usages like "chown root.root f", which have the nonstandard and long-obsolete "." separator that causes problems on platforms where user names contain ".". Applications should use ":" instead of ".". * cksum no longer allows abbreviated algorithm names, so that forward compatibility and robustness is improved. * date +'%-N' now suppresses excess trailing digits, instead of always padding them with zeros to 9 digits. It uses clock_getres and clock_gettime to infer the clock resolution. OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=328
2022-04-26 10:21:31 +02:00
@@ -366,6 +396,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);
}