Repository navigation
utmpx: fall back to logind when default utmp is unavailable - #11579
mattsu2020 wants to merge 1 commit into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Merging this PR will not alter performance1 warning, 1 note
Comparing Footnotes
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
It seems pure Rust solution is possible: https://github.com/lucab/zbus_systemd (thought maintainer might not want to add such dep...) |
|
nice, ok |
This comment was marked as resolved.
This comment was marked as resolved.
|
An additional reason that we want to have this PR: #13212 |
See #8376 (comment) where I explained why I did not use zbus in the implementation of systemd-logind. It is a huge crate. |
|
Will it still be compatible with GNU coreutils behavior? how much is it deviating? the goal of the initial implementation of systemd-logind was to have the same behavior than GNU coreutils. |
|
https://github.com/mattsu2020/coreutils/tree/users-zbus |
|
I think it is acceptible since |
I've reworked the PR to use zbus, as I determined that the increase in binary size is not significant enough to be a concern. |
537d701 to
4e451f9
Compare
This comment was marked as outdated.
This comment was marked as outdated.
| const UTMP_LOCK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10); | ||
|
|
||
| #[cfg(all(target_os = "linux", not(target_env = "musl")))] | ||
| fn lock_utmp( |
There was a problem hiding this comment.
why do we reimplement getutxent() with our own fcntl locking on linux?
this is a lot of new code unrelated to the logind fallback, please split it into another pr
| let api = ffi::SystemdLoginApi::load().map_err(|e| { | ||
| USimpleError::new( | ||
| 1, | ||
| crate::translate!("systemd-logind-error-load-library", "error" => e), |
There was a problem hiding this comment.
this error is thrown away by read_logind(options).ok() in utmpx.rs, so nobody will see it
do we need the translation, the two ftl entries and the test in locale.rs?
| /// The default requests both fields. Traditional utmp records and the boot | ||
| /// timestamp are unaffected. | ||
| #[derive(Clone, Copy, Debug, Eq, PartialEq)] | ||
| pub struct ReadOptions { |
There was a problem hiding this comment.
do we really need ReadOptions? asking logind for the start time and the leader is cheap, and every caller would get simpler
There was a problem hiding this comment.
Removed ReadOptions.
|
thanks for the patch! |
|
I think we should use zbus at least for static musl. |
I'll consider handling static musl separately to keep this PR focused. |
When Linux's default utmp has no complete record, try logind for who, users, pinky and uptime. Keep populated traditional files first.
Related to #3219 and #8376; zbus support follows in #16231.