Skip to content

Commit cc6a852

Browse files
committed
enable utmpx feature for musl
musl provides stubs of those 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 uutils#1361 Signed-off-by: Etienne Cordonnier <[email protected]>
1 parent 01a3936 commit cc6a852

File tree

3 files changed

+1
-2
lines changed

3 files changed

+1
-2
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ feat_os_unix_musl = [
176176
#
177177
"feat_require_unix",
178178
"feat_require_unix_hostid",
179+
"feat_require_unix_utmpx",
179180
]
180181
feat_os_unix_android = [
181182
"feat_Tier1",

src/uucore/src/lib/features.rs

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ pub mod signals;
7474
not(target_os = "fuchsia"),
7575
not(target_os = "openbsd"),
7676
not(target_os = "redox"),
77-
not(target_env = "musl"),
7877
feature = "utmpx"
7978
))]
8079
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)