Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
10000 uname: return processor type instead of "unknown" by naoNao89 · Pull Request #8842 · uutils/coreutils · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

naoNao89
Copy link
Contributor
@naoNao89 naoNao89 commented Oct 8, 2025

Enhance uname -p to return processor architecture information instead of "unknown".

Currently uname -p always returns "unknown", making it useless:

$ uname -p
unknown

This PR makes it return meaningful information by mapping from machine architecture:

$ uname -p
aarch64

$ uname -m
aarch64

@naoNao89 naoNao89 force-pushed the fix-uname-processor-unknown-8659 branch from fcd941a to 3d44a18 Compare October 8, 2025 05:06
@naoNao89 naoNao89 changed the title fix uname -p returning "unknown" uname: return processor type instead of "unknown" Oct 8, 2025
@naoNao89 naoNao89 force-pushed the fix-uname-processor-unknown-8659 branch from 3d44a18 to 6e1f657 Compare October 8, 2025 05:12
@github-actions
Copy link
github-actions bot commented Oct 8, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

///
/// Fixes: <https://github.com/uutils/coreutils/issues/8659>
fn map_processor(machine: &str) -> String {
match machine {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about merging this into https://crates.io/crates/platform-info ?

@naoNao89 naoNao89 marked this pull request as draft October 8, 2025 15:18
@naoNao89
Copy link
Contributor Author
naoNao89 commented Oct 8, 2025

i have opened uutils/platform-info#96 to add the processor() method to the platform-info crate.

once that's merged and released, we can update this PR to use info.processor() instead of the local map_processor() function.

@collinfunk
Copy link

Fix uname -p returning "unknown" by mapping machine architecture strings to processor types, matching GNU coreutils behavior.

This is incorrect. GNU Coreutils returns unknown in many cases.

On x86_64 GNU/Linux:

$ uname --version | head -n 1
uname (GNU coreutils) 9.8.11-bfcfe
$ uname -p
unknown

On aarch64 GNU/Linux:

$ uname --version | head -n 1
uname (GNU coreutils) 9.7
$ uname -p
unknown

See discussion on the history of this option discussed on the GNU Coreutils mailing list.

[1] https://lists.gnu.org/archive/html/coreutils/2025-09/msg00236.html
[2] https://lists.gnu.org/archive/html/coreutils/2025-09/msg00237.html

@sylvestre
Copy link
Contributor

@collinfunk many thanks for the input :)

@naoNao89
Copy link
Contributor Author
naoNao89 commented Oct 9, 2025

I'm reframing this PR from "bug fix" to "feature enhancement".

The original issue was resolved downstream (Ubuntu patched kdump-tools to use uname -m), but uname -p returning "unknown" isn't useful. This PR enhances it to return meaningful processor information.

ref: https://bugs.launchpad.net/ubuntu/+source/coreutils-from/+bug/2122648

@naoNao89
Copy link
Contributor Author
naoNao89 commented Oct 9, 2025

testing shows that the current behavior matches standard GNU coreutils:

Standard GNU coreutils behavior (returning "unknown"):

$ podman run --rm debian:latest uname -p
unknown

$ podman run --rm fedora:latest uname -p
unknown

$ podman run --rm alpine:latest uname -p
unknown

With this PR applied (returning mapped values):

$ podman run --rm -v ./target/release/uname:/usr/local/bin/uname debian:latest /usr/local/bin/uname -p
aarch64

$ podman run --rm -v ./target/release/uname:/usr/local/bin/uname fedora:latest /usr/local/bin/uname -p
aarch64

$ podman run --rm -v ./target/release/uname:/usr/local/bin/uname ubuntu:latest /usr/local/bin/uname -p
aarch64

@collinfunk
Copy link

I'm reframing this PR from "bug fix" to "feature enhancement".

The original issue was resolved downstream (Ubuntu patched kdump-tools to use uname -m), but uname -p returning "unknown" isn't useful. This PR enhances it to return meaningful processor information.

ref: https://bugs.launchpad.net/ubuntu/+source/coreutils-from/+bug/2122648

But why? No one uses uname -p.

The script that was fixed there was a Ubuntu invention that was added on top of Debian's kdump-tools package, which they import [1]. You can verify from this from a container:

$ podman run -it --rm ubuntu:rolling 
$ apt-get update -y && apt-get upgrade -y && apt-get install -y kdump-tools
$ ls /usr/share/kdump-tools/kdump_set_default 
/usr/share/kdump-tools/kdump_set_default
$ podman run --rm -it debian:experimental
$ apt-get update -y && apt-get upgrade -y && apt-get install -y kdump-tools
$ ls /usr/share/kdump-tools/kdump_set_default
ls: cannot access '/usr/share/kdump-tools/kdump_set_default': No such file or directory

[1] https://launchpad.net/ubuntu/+source/kdump-tools/1:1.10.7ubuntu1

@sylvestre
Copy link
Contributor

@collinfunk

No one uses uname -p.

We don't judge the usage of an option. We want to be a full drop-in-replacement of GNU :)

@collinfunk
Copy link

We don't judge the usage of an option. We want to be a full drop-in-replacement of GNU :)

The issue that I have with this proposal is that it diverges from the longstanding behavior of GNU. Also busybox and toybox for that matter:

$ uname -a
Linux 391e1d26e6c7 6.8.11-300.fc40.aarch64 #1 SMP PREEMPT_DYNAMIC Mon May 27 15:22:03 UTC 2024 aarch64 GNU/Linux
$ uname -p
unknown
$ busybox uname -p
unknown
$ toybox uname -p
unknown

If anyone wants the processor type, they just use uname -m which has been around since at least SUSv2 [1]:

$ uname -m
aarch64

If you look up "uname -p" on GitHub, you can fi 8000 nd that many people have something in their dotfiles like this:

if test $(uname -p) = arm; then
  # Do MacOS specific setup.
  [...]
fi

This extension will almost certainly break people's configurations. And it will likely break some ./configure (or similar) scripts.

[1] https://pubs.opengroup.org/onlinepubs/007908799/xcu/uname.html

@sylvestre
Copy link
Contributor

OK, I understand now your concerns. We should do the same then :)
Thanks for taking the time!

@naoNao89
Copy link
Contributor Author

uname -p has been returning "unknown" for 20 years, and people have been complaining about it just as long.

But here's the thing: Ubuntu and Fedora have been patching GNU to fix this since 2009 (16 years!):

Ubuntu's patch: 80_fedora_sysinfo.patch

  • Originally from Fedora 12 (2009)
  • Ships in every Ubuntu release since then
  • Makes uname -p return actual architecture instead of "unknown"
# Ubuntu 24.04
$ uname -p
aarch64  # actual useful info!

If major distros have been patching GNU to do this for 16 years, there's clearly real demand.

What this PR does:

Simple mapping with safe fallback:

  • aarch64/arm64arm
  • x86_64/amd64x86_64
  • i686/i386i386
  • Everything else → unknown
    Covers 99% of systems, preserves "unknown" for edge cases.

Why it matters: uutils isn't GNU. We can follow Ubuntu/Fedora's 16-year-proven approach instead of stubbornly returning "unknown."

macOS has been doing this forever. Ubuntu/Fedora patch GNU to do it. Time for uutils to do the same.

@naoNao89 naoNao89 marked this pull request as ready for review October 20, 2025 13:36
@sylvestre
Copy link
Contributor

i didn't know that it was patched by distro. Ok, let's do it then

@collinfunk
Copy link

But here's the thing: Ubuntu and Fedora have been patching GNU to fix this since 2009 (16 years!):

Fedora stopped patching this years ago: https://src.fedoraproject.org/rpms/coreutils/c/cd953e11dd78cada371f0389171cea671949141b?branch=rawhide

There really is no benefit, and you risk breaking peoples scripts or, even worse, ./configure scripts.

@naoNao89
Copy link
Contributor Author

@collinfunk. You're right that Fedora removed their uname patch in August 2022 to align with upstream GNU behavior, citing portability concerns per the 2015 GNU coreutils commit.

However, the landscape remains split. Reproduction evidence:

Ubuntu 24.04 (patched since 2009):

$ uname -p
x86_64

Fedora 41/Debian 12 (upstream GNU):

$ uname -p
unknown

macOS (BSD uname, always provided real data):

$ uname -p
arm  # or i386 on Intel Macs

This PR aligns with Ubuntu/macOS behavior where users benefit from actual processor data. While GNU discourages reliance on -p due to POSIX non-standardization, the practical reality is that many users on patched systems expect meaningful output.

@RGBCube
Copy link
Contributor
RGBCube commented Oct 20, 2025

I was confused by @collinfunk's comment on the MacOS snippet, as I had the same arm output by running it on a distro that patches it. Nice to know at least.

(off-topic) @naoNao89 I'm not sure if you realize it, but it's obvious that you're generating your messages with some form of LLM. I don't personally mind, but keep in mind it's something that may annoy some people/make them less likely to interact.

@naoNao89
Copy link
Contributor Author

@RGBCube yeah, I know am lazy about writing complete sentences. I just jot down the key steps and use an LLM to complete it

@oech3
Copy link
Contributor
oech3 commented Oct 22, 2025

Debian's coreutils already have difference with GNU coreutils related with uname.
arch is not built by default. Because uname -m is enough. But debian has it.

If this project want to same with upstream, we should close this PR and exclude arch by default.

@sylvestre
Copy link
Contributor

@RGBCube yeah, I know am lazy about writing complete sentences. I just jot down the key steps and use an LLM to complete it

please avoid doing this here ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

0