Skip to content

Commit 1ec4478

Browse files
committed
add musl utmpx limitation to --help texts
Signed-off-by: Etienne Cordonnier <[email protected]>
1 parent 0354f1f commit 1ec4478

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

src/uu/pinky/src/pinky.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ use uucore::{format_usage, help_about, help_usage};
1010

1111
mod platform;
1212

13+
#[cfg(target_env = "musl")]
14+
const ABOUT: &str = concat!(
15+
help_about!("pinky.md"),
16+
"\n\nWarning: When built with musl libc, the `pinky` utility may show incomplete \n",
17+
"or missing user information due to musl's stub implementation of `utmpx` \n",
18+
"functions. This limitation affects the ability to retrieve accurate details \n",
19+
"about logged-in users."
20+
);
21+
22+
#[cfg(not(target_env = "musl"))]
1323
const ABOUT: &str = help_about!("pinky.md");
24+
1425
const USAGE: &str = help_usage!("pinky.md");
1526

1627
mod options {

src/uu/uptime/src/uptime.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ use uucore::{format_usage, help_about, help_usage};
2323
#[cfg(not(target_os = "openbsd"))]
2424
use uucore::utmpx::*;
2525

26+
#[cfg(target_env = "musl")]
27+
const ABOUT: &str = concat!(
28+
help_about!("uptime.md"),
29+
"\n\nWarning: When built with musl libc, the `uptime` utility may show '0 users' \n",
30+
"due to musl's stub implementation of utmpx functions. Boot time and load averages \n",
31+
"are still calculated using alternative mechanisms."
32+
);
33+
34+
#[cfg(not(target_env = "musl"))]
2635
const ABOUT: &str = help_about!("uptime.md");
36+
2737
const USAGE: &str = help_usage!("uptime.md");
2838
pub mod options {
2939
pub static SINCE: &str = "since";

src/uu/users/src/users.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ use utmp_classic::{UtmpEntry, parse_from_path};
1818
#[cfg(not(target_os = "openbsd"))]
1919
use uucore::utmpx::{self, Utmpx};
2020

21+
#[cfg(target_env = "musl")]
22+
const ABOUT: &str = concat!(
23+
help_about!("users.md"),
24+
"\n\nWarning: When built with musl libc, the `users` utility may show '0 users' \n",
25+
"due to musl's stub implementation of utmpx functions."
26+
);
27+
28+
#[cfg(not(target_env = "musl"))]
2129
const ABOUT: &str = help_about!("users.md");
30+
2231
const USAGE: &str = help_usage!("users.md");
2332

2433
#[cfg(target_os = "openbsd")]

src/uu/who/src/who.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@ mod options {
2828
pub const FILE: &str = "FILE"; // if length=1: FILE, if length=2: ARG1 ARG2
2929
}
3030

31+
#[cfg(target_env = "musl")]
32+
const ABOUT: &str = concat!(
33+
help_about!("who.md"),
34+
"\n\nWarning: When built with musl libc, the `who` utility may show incomplete \n",
35+
"or missing user information due to musl's stub implementation of `utmpx` \n",
36+
"functions. This limitation affects the ability to retrieve accurate details \n",
37+
"about logged-in users."
38+
);
39+
40+
#[cfg(not(target_env = "musl"))]
3141
const ABOUT: &str = help_about!("who.md");
42+
3243
const USAGE: &str = help_usage!("who.md");
3344

3445
#[cfg(target_os = "linux")]

0 commit comments

Comments
 (0)