Skip to content

tests/utmpx: check logind timestamps and leader PIDs - #16231

Draft
mattsu2020 wants to merge 15 commits into
uutils:mainfrom
mattsu2020:users-zbus
Draft

mattsu2020 wants to merge 15 commits into
uutils:mainfrom
mattsu2020:users-zbus

Conversation

@mattsu2020

@mattsu2020 mattsu2020 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Check the login time in who -u and pinky, and the session leader PID in who -u. Verify that each field displays ? when sd-login cannot supply its value.

Depends on #11579.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 156.91 MB (+1.54 MB, +0.99%)

Significant per-binary changes:
  pinky     1.21 MB ->    1.92 MB  (+728 KB, +58.71%)
  who       1.21 MB ->    1.92 MB  (+724 KB, +58.20%)

@mattsu2020

Copy link
Copy Markdown
Contributor Author

Personally, I prefer the zbus-based approach because I find it allows for cleaner code.

@mattsu2020 mattsu2020 changed the title utmpx: use zbus for Linux logind fallback utmpx: query missing logind session details with zbus Nov 7, 2026
Comment thread docs/src/wasi-test-gaps.md Resolved
# * cargo
cdylib
doctest
libloading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You no nonger dlopen.

@mattsu2020 mattsu2020 Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because the spell checker reported an error.

@codspeed

codspeed Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning, 1 note

⚠️ 123 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

✅ 405 untouched benchmarks
⏩ 70 skipped benchmarks1


Comparing mattsu2020:users-zbus (fbd195c) with main (a68dc1e)

Open in CodSpeed

Footnotes

  1. 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread tests/fixtures/who/logind_redirect.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use binaries provided by systemd itself at our test and remove unsafe dlopen.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running some basic tests, but it looks like we can remove it.

@mattsu2020
mattsu2020 force-pushed the users-zbus branch 3 times, most recently from e3aedcd to 699d00d Compare November 7, 2026 10:18
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why both?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu 22.04 tests the D-Bus fallback used by older systemd versions.
Ubuntu 24.04 tests direct access through newer sd-login APIs.
Both are needed to cover these different code paths.
If testing just one of them is sufficient, I'll consolidate them into one.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ubuntu-22.04 runner image is deprecated and will be retired in April 2027, how can we test it then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu's LTS support period is relatively short. How about using Debian instead? I think that could work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub does not provide it. Do we really need to care about legacy API?
We should support what user want to do at 1st.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to run CI/CD tests only on the latest version and remove the Ubuntu 22.04 image.

Since we already have unit tests in place, I believe this should be sufficient.

Comment thread deny.toml Resolved
@mattsu2020 mattsu2020 mentioned this pull request Nov 7, 2026
@mattsu2020
mattsu2020 force-pushed the users-zbus branch 2 times, most recently from 1fddbf7 to 7497d44 Compare November 8, 2026 14:28
@mattsu2020
mattsu2020 marked this pull request as ready for review November 17, 2026 06:35
@sylvestre

Copy link
Copy Markdown
Contributor

thanks for the patch!
The zbus part makes who and pinky 58% bigger, just for systemd < 254. See the comment on bus.rs.
Please also wait until #11579 and #16255 land, rebase on them, and squash everything into one commit.

pub(super) leader: Option<u32>,
}

pub(super) fn session_details(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this costs +58% on who and pinky (~700KB) only for systemd < 254, is it worth it?
printing ? there seems good enough to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that approach.

if record.login_time == UNIX_EPOCH {
record.login_time = details
.start_time
.and_then(|usec| UNIX_EPOCH.checked_add(std::time::Duration::from_micros(usec)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same conversion as line 454, could be dedup

Comment thread tests/by-util/test_split.rs Outdated
new_ucmd!()
.args(args)
// Argument validation can close stdin before the writer finishes.
.ignore_stdin_write_error()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now called twice, and unrelated to this PR, please drop it from here

@mattsu2020
mattsu2020 marked this pull request as draft November 18, 2026 13:01
@mattsu2020 mattsu2020 changed the title utmpx: query missing logind session details with zbus tests/utmpx: check logind timestamps and leader PIDs Nov 18, 2026
Remove the unrelated split test changes from this branch.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants