Skip to content

Commit af33a0d

Browse files
Ecordonniercakebaker
authored andcommitted
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 #1361 Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
1 parent c90bca4 commit af33a0d

File tree

3 files changed

+1
-2
lines changed

3 files changed

+1
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
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",

src/uucore/src/lib/features.rs

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 1 deletion
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)