-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
uname: return processor type instead of "unknown" #8842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
fcd941a
to
3d44a18
Compare
uname -p
returning "unknown"3d44a18
to
6e1f657
Compare
GNU testsuite comparison:
|
/// | ||
/// Fixes: <https://github.com/uutils/coreutils/issues/8659> | ||
fn map_processor(machine: &str) -> String { | ||
match machine { |
There was a problem hiding this comment.
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 ?
i have opened uutils/platform-info#96 to add the once that's merged and released, we can update this PR to use |
This is incorrect. GNU Coreutils returns On x86_64 GNU/Linux:
On aarch64 GNU/Linux:
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 |
@collinfunk many thanks for the input :) |
I'm reframing this PR from "bug fix" to "feature enhancement". The original issue was resolved downstream (Ubuntu patched kdump-tools to use ref: https://bugs.launchpad.net/ubuntu/+source/coreutils-from/+bug/2122648 |
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):
|
But why? No one uses The script that was fixed there was a Ubuntu invention that was added on top of Debian's
[1] https://launchpad.net/ubuntu/+source/kdump-tools/1:1.10.7ubuntu1 |
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
If anyone wants the processor type, they just use
If you look up
This extension will almost certainly break people's configurations. And it will likely break some [1] https://pubs.opengroup.org/onlinepubs/007908799/xcu/uname.html |
OK, I understand now your concerns. We should do the same then :) |
But here's the thing: Ubuntu and Fedora have been patching GNU to fix this since 2009 (16 years!): Ubuntu's patch:
# 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:
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. |
i didn't know that it was patched by distro. Ok, let's do it then |
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, |
@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 |
I was confused by @collinfunk's comment on the MacOS snippet, as I had the same (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. |
@RGBCube yeah, I know am lazy about writing complete sentences. I just jot down the key steps and use an LLM to complete it |
Debian's coreutils already have difference with GNU coreutils related with uname. If this project want to same with upstream, we should close this PR and exclude |
please avoid doing this here ;) |
Enhance
uname -p
to return processor architecture information instead of "unknown".Currently
uname -p
always returns "unknown", making it useless:This PR makes it return meaningful information by mapping from machine architecture: