Skip to content

Commit f0440ae

Browse files
committed
enable utmpx feature for musl
bump libc to 0.2.172 musl provides stubs of utmpx functions, and those stubs are available in the libc crate version 0.2.172. Thus let's enable the feature so that it can compile with musl. Note that those stubs always return a success exit value, and commands such as "users" will report an empty list of users, when calling those stubs. This is consistent with the behavior of GNU coreutils which does the same thing. The coreutils utillities using utmpx are "pinky", "uptime", "users", "who". This is the expected behavior when using those utilities compiled with those musl utmpx stubs: ``` root@qemuarm64:~# users root@qemuarm64:~# echo $? 0 root@qemuarm64:~# pinky Login Name TTY Idle When Where root@qemuarm64:~# echo $? 0 root@qemuarm64:~# uptime 12:58:47 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 root@qemuarm64:~# echo $? 0 root@qemuarm64:~# who root@qemuarm64:~# echo $? 0 ``` Closes #1361 Signed-off-by: Etienne Cordonnier <[email protected]>
1 parent 1f133c5 commit f0440ae

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ feat_os_unix_musl = [
178178
"feat_require_crate_cpp",
179179
"feat_require_unix",
180180
"feat_require_unix_hostid",
181+
"feat_require_unix_utmpx",
181182
]
182183
feat_os_unix_android = [
183184
"feat_Tier1",
@@ -308,7 +309,7 @@ hostname = "0.4"
308309
iana-time-zone = "0.1.57"
309310
indicatif = "0.17.8"
310311
itertools = "0.14.0"
311-
libc = "0.2.153"
312+
libc = "0.2.172"
312313
linux-raw-sys = "0.9"
313314
lscolors = { version = "0.20.0", default-features = false, features = [
314315
"gnu_legacy",

src/uucore/src/lib/features.rs

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ pub mod signals;
7676
not(target_os = "fuchsia"),
7777
not(target_os = "openbsd"),
7878
not(target_os = "redox"),
79-
not(target_env = "musl"),
8079
feature = "utmpx"
8180
))]
8281
pub mod utmpx;

src/uucore/src/lib/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ pub use crate::features::signals;
8989
not(target_os = "fuchsia"),
9090
not(target_os = "openbsd"),
9191
not(target_os = "redox"),
92-
not(target_env = "musl"),
9392
feature = "utmpx"
9493
))]
9594
pub use crate::features::utmpx;

0 commit comments

Comments
 (0)