Skip to content

Commit

Permalink
coreutils - add patch to fix uname (microsoft#9420)
Browse files Browse the repository at this point in the history
  • Loading branch information
anphel31 authored and xiaohongdeng committed Nov 21, 2024
1 parent 149a0ed commit a56e3d9
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 11 deletions.
69 changes: 69 additions & 0 deletions SPECS/coreutils/coreutils-9.4-uname-1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From e92876a5257bc762eb61c2f12f0338be493ab939 Mon Sep 17 00:00:00 2001
From: Rachel Menge <[email protected]>
Date: Wed, 29 May 2024 22:27:32 +0000
Subject: [PATCH] coreutils-9.4 uname patch for -i and -p

Original commit info:

Submitted by: William Immendorf <[email protected]>
Date: 2010-05-08
Inital Package Version: 8.5
Origin: http://cvs.fedoraproject.org/viewvc/devel/coreutils/coreutils-8.2-uname-processortype.patch
Upstream Status: Rejected
Description: Fixes the output of uname's -i and -p parameters
---
src/uname.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/uname.c b/src/uname.c
index 883b9a4..78641bf 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -313,7 +313,7 @@ main (int argc, char **argv)

if (toprint & PRINT_PROCESSOR)
{
- char const *element = unknown;
+ char *element = unknown;
#ifdef __APPLE__
# if defined __arm__ || defined __arm64__
element = "arm";
@@ -330,6 +330,12 @@ main (int argc, char **argv)
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
element = processor;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ }
#endif
#ifdef UNAME_PROCESSOR
if (element == unknown)
@@ -347,7 +353,7 @@ main (int argc, char **argv)

if (toprint & PRINT_HARDWARE_PLATFORM)
{
- char const *element = unknown;
+ char *element = unknown;
#if HAVE_SYSINFO && defined SI_PLATFORM
{
static char hardware_platform[257];
@@ -355,6 +361,14 @@ main (int argc, char **argv)
hardware_platform, sizeof hardware_platform))
element = hardware_platform;
}
+#else
+ {
+ struct utsname u;
+ uname(&u);
+ element = u.machine;
+ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
+ element[1]='3';
+ }
#endif
#ifdef UNAME_HARDWARE_PLATFORM
if (element == unknown)
--
2.34.1
6 changes: 5 additions & 1 deletion SPECS/coreutils/coreutils.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Summary: Basic system utilities
Name: coreutils
Version: 9.4
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand All @@ -11,6 +11,7 @@ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
# make this package to own serial console profile since it utilizes stty tool
Source1: serial-console.sh
Patch0: coreutils-9.4-i18n-1.patch
Patch1: coreutils-9.4-uname-1.patch
BuildRequires: libselinux-devel
BuildRequires: libselinux-utils
Requires: gmp
Expand Down Expand Up @@ -91,6 +92,9 @@ LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 make -k check
%defattr(-,root,root)

%changelog
* Mon Jun 17 2024 Andrew Phelps <[email protected]> - 9.4-3
- add coreutils-9.4-uname-1.patch

* Wed Mar 20 2024 Dan Streetman <[email protected]> - 9.4-2
- fix serial-console.sh

Expand Down
4 changes: 2 additions & 2 deletions toolkit/resources/manifests/package/pkggen_core_aarch64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ ncurses-libs-6.4-2.azl3.aarch64.rpm
ncurses-term-6.4-2.azl3.aarch64.rpm
readline-8.2-1.azl3.aarch64.rpm
readline-devel-8.2-1.azl3.aarch64.rpm
coreutils-9.4-2.azl3.aarch64.rpm
coreutils-lang-9.4-2.azl3.aarch64.rpm
coreutils-9.4-3.azl3.aarch64.rpm
coreutils-lang-9.4-3.azl3.aarch64.rpm
bash-5.2.15-2.azl3.aarch64.rpm
bash-devel-5.2.15-2.azl3.aarch64.rpm
bash-lang-5.2.15-2.azl3.aarch64.rpm
Expand Down
4 changes: 2 additions & 2 deletions toolkit/resources/manifests/package/pkggen_core_x86_64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ ncurses-libs-6.4-2.azl3.x86_64.rpm
ncurses-term-6.4-2.azl3.x86_64.rpm
readline-8.2-1.azl3.x86_64.rpm
readline-devel-8.2-1.azl3.x86_64.rpm
coreutils-9.4-2.azl3.x86_64.rpm
coreutils-lang-9.4-2.azl3.x86_64.rpm
coreutils-9.4-3.azl3.x86_64.rpm
coreutils-lang-9.4-3.azl3.x86_64.rpm
bash-5.2.15-2.azl3.x86_64.rpm
bash-devel-5.2.15-2.azl3.x86_64.rpm
bash-lang-5.2.15-2.azl3.x86_64.rpm
Expand Down
6 changes: 3 additions & 3 deletions toolkit/resources/manifests/package/toolchain_aarch64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ chkconfig-debuginfo-1.25-1.azl3.aarch64.rpm
chkconfig-lang-1.25-1.azl3.aarch64.rpm
cmake-3.28.2-6.azl3.aarch64.rpm
cmake-debuginfo-3.28.2-6.azl3.aarch64.rpm
coreutils-9.4-2.azl3.aarch64.rpm
coreutils-debuginfo-9.4-2.azl3.aarch64.rpm
coreutils-lang-9.4-2.azl3.aarch64.rpm
coreutils-9.4-3.azl3.aarch64.rpm
coreutils-debuginfo-9.4-3.azl3.aarch64.rpm
coreutils-lang-9.4-3.azl3.aarch64.rpm
cpio-2.14-1.azl3.aarch64.rpm
cpio-debuginfo-2.14-1.azl3.aarch64.rpm
cpio-lang-2.14-1.azl3.aarch64.rpm
Expand Down
6 changes: 3 additions & 3 deletions toolkit/resources/manifests/package/toolchain_x86_64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ chkconfig-debuginfo-1.25-1.azl3.x86_64.rpm
chkconfig-lang-1.25-1.azl3.x86_64.rpm
cmake-3.28.2-6.azl3.x86_64.rpm
cmake-debuginfo-3.28.2-6.azl3.x86_64.rpm
coreutils-9.4-2.azl3.x86_64.rpm
coreutils-debuginfo-9.4-2.azl3.x86_64.rpm
coreutils-lang-9.4-2.azl3.x86_64.rpm
coreutils-9.4-3.azl3.x86_64.rpm
coreutils-debuginfo-9.4-3.azl3.x86_64.rpm
coreutils-lang-9.4-3.azl3.x86_64.rpm
cpio-2.14-1.azl3.x86_64.rpm
cpio-debuginfo-2.14-1.azl3.x86_64.rpm
cpio-lang-2.14-1.azl3.x86_64.rpm
Expand Down

0 comments on commit a56e3d9

Please sign in to comment.