Skip to content

utmpx: preserve the selected source across iterators - #16284

Open
mattsu2020 wants to merge 3 commits into
uutils:mainfrom
mattsu2020:utmpx/persist-selected-path
Open

mattsu2020 wants to merge 3 commits into
uutils:mainfrom
mattsu2020:utmpx/persist-selected-path

Conversation

@mattsu2020

@mattsu2020 mattsu2020 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

With systemd_logind enabled, iter_all_records() switches back to systemd after reading a custom file. Keep using the selected file until DEFAULT_FILE is explicitly selected, and add a regression test for repeated iterators.

Depends on #16233; related to #8376.

Comment thread src/uucore/src/lib/features/utmpx.rs Resolved
Comment thread src/uucore/src/lib/features/utmpx.rs Resolved
@codspeed

codspeed Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 3.34%

2 warnings, 1 note

⚠️ 126 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 with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

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

⚡ 1 improved benchmark
✅ 404 untouched benchmarks
⏩ 70 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation du_wide_tree[(5000, 500)] 15.9 ms 15.3 ms +3.34%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mattsu2020:utmpx/persist-selected-path (dad413a) 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 .github/workflows/CICD.yml Outdated
run: |
sudo apt-get update
sudo apt-get install -y libsystemd-dev
cargo test -p uucore --lib --locked --features systemd_logind traditional_paths_persist_across_iterators

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.

could you drop the test name filter? the other systemd_logind tests in uucore would run too

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.

fixed it

@mattsu2020
mattsu2020 force-pushed the utmpx/persist-selected-path branch from e7ec946 to 5a1daa5 Compare November 9, 2026 10:23
Open and validate a nonblocking descriptor, then select it for libc via
/proc/self/fd. Keep getutxent for record reads and locking.

Cover FIFO rejection, path replacement, invalid inputs and cleanup.
Use one test-only helper for the uucore unit tests and who FIFO test.
Keep the helper inside uucore so it is included in the crate package.

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.

2 participants