Skip to content

shuf: handle default RNG init failures gracefully#11162

Closed
jorgitin02 wants to merge 2 commits intouutils:mainfrom
jorgitin02:fix/11152-strace-e-inject-getrandom-error-eaga
Closed

shuf: handle default RNG init failures gracefully#11162
jorgitin02 wants to merge 2 commits intouutils:mainfrom
jorgitin02:fix/11152-strace-e-inject-getrandom-error-eaga

Conversation

@jorgitin02
Copy link

Fixes #11152.

This avoids panicking when default RNG initialization fails (for example when getrandom returns EAGAIN under syscall fault injection).

Changes:

  • Switch default shuf RNG init to fallible StdRng::try_from_os_rng.
  • Convert RNG init failure into a normal user-facing error path.
  • Add regression/safety tests for default/seed/file random-source paths.

Signed-off-by: jorge guerrero <grrr.jrg@gmail.com>
@oech3
Copy link
Contributor

oech3 commented Mar 1, 2026

Would you fallback instead of err? GNU's test suite decided to accept it.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/rm/isatty is no longer failing!

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 1, 2026

Merging this PR will degrade performance by 3.38%

❌ 1 regressed benchmark
✅ 293 untouched benchmarks
⏩ 42 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation shuf_input_range[1000000] 84.2 ms 87.1 ms -3.38%

Comparing jorgitin02:fix/11152-strace-e-inject-getrandom-error-eaga (4e0ee46) with main (ba94c69)

Open in CodSpeed

Footnotes

  1. 42 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.

@jorgitin02
Copy link
Author

Would you fallback instead of err? GNU's test suite decided to accept it.

This pr only touches shuf, so the cp_large_file[16] slowdown looks
unrelated. ill wait for the latest run and acknowledge if it stays the only regression.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/rm/isatty is no longer failing!

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/rm/isatty is no longer failing!

@oech3

This comment was marked as resolved.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/rm/isatty is no longer failing!

@oech3
Copy link
Contributor

oech3 commented Mar 1, 2026

Please drop unrelated stdbuf commit.

@jorgitin02 jorgitin02 force-pushed the fix/11152-strace-e-inject-getrandom-error-eaga branch 2 times, most recently from 19f419e to 4e0ee46 Compare March 1, 2026 16:47
@jorgitin02
Copy link
Author

Please drop unrelated stdbuf commit.

done

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/rm/isatty is no longer failing!
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.

@oech3
Copy link
Contributor

oech3 commented Mar 1, 2026

Flakeyness of shuf_input_range will be removed by #11169 .

@jorgitin02
Copy link
Author

Closing this version and preparing a fresh follow-up.

@jorgitin02 jorgitin02 closed this Mar 1, 2026
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.

strace -e inject=getrandom:error=EAGAIN shuf -i 1-9 panics

2 participants