All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Codesamples/depends.mk : Replace non-portable uname '-p' with '-m'
@ 2023-02-04  2:55 Leonardo Bras
  0 siblings, 0 replies; 2+ messages in thread
From: Leonardo Bras @ 2023-02-04  2:55 UTC (permalink / raw)
  To: paulmck; +Cc: Leonardo Bras, perfbook

`uname -p` returns 'unknown' for current coreutils.

On GNU coreutils 9.1, the uname --help text says:

uname --help
Usage: uname [OPTION]...
[...]
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type (non-portable)
  -i, --hardware-platform  print the hardware platform (non-portable)
[...]

Looking deeper, I noticed that '-p' is supposed to be printing the
processor type when available, and not necessarily the architecture.

For printing the architecture, it's recommended to use uname -m, instead.
Even so, it seems like some distros make '-p' to return the same as '-m'
for compatibility purposes.

Anyway, change '-p' to '-m' on depends.mk to avoid getting arch=unknown.

Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 CodeSamples/depends.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CodeSamples/depends.mk b/CodeSamples/depends.mk
index 30810339..2086fe00 100644
--- a/CodeSamples/depends.mk
+++ b/CodeSamples/depends.mk
@@ -1,5 +1,5 @@
 ifeq ($(strip $(arch)),)
-arch := $(shell uname -p)
+arch := $(shell uname -m)
 endif
 
 ifeq ($(strip $(os)),)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v1] Codesamples/depends.mk : Replace non-portable uname '-p' with '-m'
@ 2023-02-04  3:01 Leonardo Bras
  0 siblings, 0 replies; 2+ messages in thread
From: Leonardo Bras @ 2023-02-04  3:01 UTC (permalink / raw)
  To: paulmck; +Cc: Leonardo Bras, perfbook

`uname -p` returns 'unknown' for current coreutils.

On GNU coreutils 9.1, the uname --help text says:

uname --help
Usage: uname [OPTION]...
[...]
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type (non-portable)
  -i, --hardware-platform  print the hardware platform (non-portable)
[...]

Looking deeper, I noticed that '-p' is supposed to be printing the
processor type when available, and not necessarily the architecture.

For printing the architecture, it's recommended to use uname -m, instead.
Even so, it seems like some distros make '-p' to return the same as '-m'
for compatibility purposes.

Anyway, change '-p' to '-m' on depends.mk to avoid getting arch=unknown.

Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
---
 CodeSamples/depends.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CodeSamples/depends.mk b/CodeSamples/depends.mk
index 30810339..2086fe00 100644
--- a/CodeSamples/depends.mk
+++ b/CodeSamples/depends.mk
@@ -1,5 +1,5 @@
 ifeq ($(strip $(arch)),)
-arch := $(shell uname -p)
+arch := $(shell uname -m)
 endif
 
 ifeq ($(strip $(os)),)
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-04  3:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04  2:55 [PATCH v1] Codesamples/depends.mk : Replace non-portable uname '-p' with '-m' Leonardo Bras
2023-02-04  3:01 Leonardo Bras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.