diff --git a/src/uu/pinky/locales/en-US.ftl b/src/uu/pinky/locales/en-US.ftl index daa79f0b4..d3b62d123 100644 --- a/src/uu/pinky/locales/en-US.ftl +++ b/src/uu/pinky/locales/en-US.ftl @@ -1,2 +1,6 @@ pinky-about = Displays brief user information on Unix-based systems pinky-usage = pinky [OPTION]... [USER]... +pinky-about-musl-warning = Warning: When built with musl libc, the `pinky` utility may show incomplete + or missing user information due to musl's stub implementation of `utmpx` + functions. This limitation affects the ability to retrieve accurate details + about logged-in users. diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 2f6876611..3f0f13d97 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -7,21 +7,10 @@ use clap::{Arg, ArgAction, Command}; use uucore::format_usage; +use uucore::locale::get_message; mod platform; -#[cfg(target_env = "musl")] -const ABOUT: &str = concat!( - help_about!("pinky.md"), - "\n\nWarning: When built with musl libc, the `pinky` utility may show incomplete \n", - "or missing user information due to musl's stub implementation of `utmpx` \n", - "functions. This limitation affects the ability to retrieve accurate details \n", - "about logged-in users." -); - -#[cfg(not(target_env = "musl"))] -use uucore::locale::get_message; - mod options { pub const LONG_FORMAT: &str = "long_format"; pub const OMIT_HOME_DIR: &str = "omit_home_dir"; @@ -40,9 +29,14 @@ mod options { use platform::uumain; pub fn uu_app() -> Command { + #[cfg(not(target_env = "musl"))] + let about = get_message("pinky-about"); + #[cfg(target_env = "musl")] + let about = get_message("pinky-about") + &get_message("pinky-about-musl-warning"); + Command::new(uucore::util_name()) .version(uucore::crate_version!()) - .about(get_message("pinky-about")) + .about(about) .override_usage(format_usage(&get_message("pinky-usage"))) .infer_long_args(true) .disable_help_flag(true) diff --git a/src/uu/uptime/locales/en-US.ftl b/src/uu/uptime/locales/en-US.ftl index 2fe2b23ce..6746ee712 100644 --- a/src/uu/uptime/locales/en-US.ftl +++ b/src/uu/uptime/locales/en-US.ftl @@ -2,3 +2,6 @@ uptime-about = Display the current time, the length of time the system has been the number of users on the system, and the average number of jobs in the run queue over the last 1, 5 and 15 minutes. uptime-usage = uptime [OPTION]... +uptime-about-musl-warning = Warning: When built with musl libc, the `uptime` utility may show '0 users' + due to musl's stub implementation of utmpx functions. Boot time and load averages + are still calculated using alternative mechanisms. diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 081f18cab..3bf1b8d79 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -17,22 +17,12 @@ use uucore::uptime::*; use clap::{Arg, ArgAction, Command, ValueHint, builder::ValueParser}; use uucore::format_usage; +use uucore::locale::get_message; #[cfg(unix)] #[cfg(not(target_os = "openbsd"))] use uucore::utmpx::*; -#[cfg(target_env = "musl")] -const ABOUT: &str = concat!( - help_about!("uptime.md"), - "\n\nWarning: When built with musl libc, the `uptime` utility may show '0 users' \n", - "due to musl's stub implementation of utmpx functions. Boot time and load averages \n", - "are still calculated using alternative mechanisms." -); - -#[cfg(not(target_env = "musl"))] -use uucore::locale::get_message; - pub mod options { pub static SINCE: &str = "since"; pub static PATH: &str = "path"; @@ -74,9 +64,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } pub fn uu_app() -> Command { + #[cfg(not(target_env = "musl"))] + let about = get_message("uptime-about"); + #[cfg(target_env = "musl")] + let about = get_message("uptime-about") + &get_message("uptime-about-musl-warning"); + let cmd = Command::new(uucore::util_name()) .version(uucore::crate_version!()) - .about(get_message("uptime-about")) + .about(about) .override_usage(format_usage(&get_message("uptime-usage"))) .infer_long_args(true) .arg( diff --git a/src/uu/users/locales/en-US.ftl b/src/uu/users/locales/en-US.ftl index a3d5786ac..d35a99383 100644 --- a/src/uu/users/locales/en-US.ftl +++ b/src/uu/users/locales/en-US.ftl @@ -1,2 +1,4 @@ users-about = Print the user names of users currently logged in to the current host. users-usage = users [FILE] +users-about-musl-warning = Warning: When built with musl libc, the `users` utility may show '0 users', + due to musl's stub implementation of utmpx functions. diff --git a/src/uu/users/src/users.rs b/src/uu/users/src/users.rs index 0af2f390b..19b6c7c6d 100644 --- a/src/uu/users/src/users.rs +++ b/src/uu/users/src/users.rs @@ -18,14 +18,6 @@ use utmp_classic::{UtmpEntry, parse_from_path}; #[cfg(not(target_os = "openbsd"))] use uucore::utmpx::{self, Utmpx}; -#[cfg(target_env = "musl")] -const ABOUT: &str = concat!( - help_about!("users.md"), - "\n\nWarning: When built with musl libc, the `users` utility may show '0 users' \n", - "due to musl's stub implementation of utmpx functions." -); - -#[cfg(not(target_env = "musl"))] use uucore::locale::get_message; #[cfg(target_os = "openbsd")] @@ -93,9 +85,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } pub fn uu_app() -> Command { + #[cfg(not(target_env = "musl"))] + let about = get_message("users-about"); + #[cfg(target_env = "musl")] + let about = get_message("users-about") + &get_message("users-about-musl-warning"); + Command::new(uucore::util_name()) .version(uucore::crate_version!()) - .about(get_message("users-about")) + .about(about) .override_usage(format_usage(&get_message("users-usage"))) .infer_long_args(true) .arg( diff --git a/src/uu/who/locales/en-US.ftl b/src/uu/who/locales/en-US.ftl index 9b55893e6..7ed207f72 100644 --- a/src/uu/who/locales/en-US.ftl +++ b/src/uu/who/locales/en-US.ftl @@ -1,2 +1,5 @@ who-about = Print information about users who are currently logged in. who-usage = who [OPTION]... [ FILE | ARG1 ARG2 ] +who-about-musl-warning = Note: When built with musl libc, the `who` utility will not display any + information about logged-in users. This is due to musl's stub implementation + of `utmpx` functions, which prevents access to the necessary data. diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index 00e90ebce..ea3cc9873 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -7,6 +7,7 @@ use clap::{Arg, ArgAction, Command}; use uucore::format_usage; +use uucore::locale::get_message; mod platform; @@ -28,17 +29,6 @@ mod options { pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2 } -#[cfg(target_env = "musl")] -const ABOUT: &str = concat!( - help_about!("who.md"), - "\n\nNote: When built with musl libc, the `who` utility will not display any \n", - "information about logged-in users. This is due to musl's stub implementation \n", - "of `utmpx` functions, which prevents access to the necessary data." -); - -#[cfg(not(target_env = "musl"))] -use uucore::locale::get_message; - #[cfg(target_os = "linux")] static RUNLEVEL_HELP: &str = "print current runlevel"; #[cfg(not(target_os = "linux"))] @@ -48,9 +38,14 @@ static RUNLEVEL_HELP: &str = "print current runlevel (This is meaningless on non use platform::uumain; pub fn uu_app() -> Command { + #[cfg(not(target_env = "musl"))] + let about = get_message("who-about"); + #[cfg(target_env = "musl")] + let about = get_message("who-about") + &get_message("who-about-musl-warning"); + Command::new(uucore::util_name()) .version(uucore::crate_version!()) - .about(get_message("who-about")) + .about(about) .override_usage(format_usage(&get_message("who-usage"))) .infer_long_args(true) .arg(