From c74b77aec895bb8cd91c4e1ea83cff291680b9e6 Mon Sep 17 00:00:00 2001 From: Dave Hodder Date: Mon, 5 Jul 2021 22:42:42 +0100 Subject: [PATCH] uname: don't report OS as "GNU/Linux" without GNU The `uname` `-o` switch reports the operating system used. If the GNU C standard library (glibc) is not in use, for example if musl is being used instead, report "Linux" instead of "GNU/Linux". --- src/uu/uname/src/uname.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/uname/src/uname.rs b/src/uu/uname/src/uname.rs index dda859722..26b4ddd2a 100644 --- a/src/uu/uname/src/uname.rs +++ b/src/uu/uname/src/uname.rs @@ -30,8 +30,10 @@ pub mod options { pub static OS: &str = "operating-system"; } -#[cfg(target_os = "linux")] +#[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "")))] const HOST_OS: &str = "GNU/Linux"; +#[cfg(all(target_os = "linux", not(any(target_env = "gnu", target_env = ""))))] +const HOST_OS: &str = "Linux"; #[cfg(target_os = "windows")] const HOST_OS: &str = "Windows NT"; #[cfg(target_os = "freebsd")]