Skip to content

Conversation

@Alonely0
Copy link
Contributor

@Alonely0 Alonely0 commented Nov 11, 2025

Fixes issue #9099, where uu_timeout would have a static 100ms latency. This issue implements a self-pipe trick in order to run transparently on as many platforms as possible. There was a previous attempt of mine doing so with pselect(), but this failed due to macOS shenanigans and the lack of support from Rust's std for spawning with custom signal masks (which was ACP-accepted two or three years ago, but even patching it I couldn't get it to work properly…).

@Alonely0 Alonely0 force-pushed the timeout branch 5 times, most recently from 1d7e3d0 to b0b75e9 Compare November 11, 2025 12:24
@github-actions
Copy link

GNU testsuite comparison:

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

@cakebaker cakebaker changed the title Replace busy loop with select(2) timeout: Replace busy loop with select(2) Nov 11, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 13, 2025

CodSpeed Performance Report

Merging #9227 will not alter performance

Comparing Alonely0:timeout (a74ca55) with main (2da2c90)

Summary

✅ 139 untouched
⏩ 37 skipped1

Footnotes

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

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@Alonely0
Copy link
Contributor Author

Alonely0 commented Nov 13, 2025

I think I have most likely addressed the last macOS non-POSIX conformance bug, at last. Elsewhere, I will just ignore the only test that spuriously fails exclusively on obsolete macOS x86_64, and address it in the future; it is just a spurious failure on retrieving a child's exit code, because of a POSIX noncompliance bug on outdated macOS. This is most likely only an issue on how Rust's std handles the exit code retrieval, and not on real-world scenarios, so this is absolutely a non-issue compared to what this PR is fixing, sigh. I'll fix the build issue on Redox after macOS CI decides it's done bugging me and other maintainers.

@Alonely0 Alonely0 force-pushed the timeout branch 3 times, most recently from 78e2c3b to 59e7efe Compare November 13, 2025 10:47
@Alonely0
Copy link
Contributor Author

Alonely0 commented Nov 13, 2025

@cakebaker Do you have any suggestion/objection? I would like to get this issue fixed right away. I'll add some comments and rebase to latest main, then re-check CI because it was modified on main. Afterwards, unless CI says otherwise, this can be cleanly merged and close #9099.

@Alonely0 Alonely0 force-pushed the timeout branch 6 times, most recently from c245dbd to a39b6bb Compare November 13, 2025 12:41
@github-actions
Copy link

GNU testsuite comparison:

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

@github-actions
Copy link

GNU testsuite comparison:

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

@Alonely0 Alonely0 force-pushed the timeout branch 2 times, most recently from 0a95bca to 9159c2d Compare November 13, 2025 14:08
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@Alonely0 Alonely0 force-pushed the timeout branch 3 times, most recently from f717715 to d062a3d Compare November 13, 2025 15:20
Fixed an issue where timeout would not force-kill due to wrong error handling on signal(), and also made error handle more robust for internal errors.
@Alonely0 Alonely0 force-pushed the timeout branch 2 times, most recently from bf2c50d to 9643c59 Compare January 5, 2026 01:02
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/follow-name is no longer failing!

Now tests time out, so we can track regressions in timeout. Also added one to track nested timeouts.

Co-authored-by: naoNao89 <[email protected]>
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

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

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/basenc/bounded-memory is now passing!
Note: The gnu test tests/dd/no-allocate was skipped on 'main' but is now failing.

@Alonely0 Alonely0 force-pushed the timeout branch 4 times, most recently from f0ae6a5 to 7504645 Compare January 5, 2026 18:05
@ChrisDryden
Copy link
Collaborator

I don't know of a way that you can read the pipe signals to be able to handle the ignore signals and flags without it being overriden by the rust runtime without reading them in the .data_init section. Theres an implementation of it here: #9657

I think it would be much simpler to take this approach than whats in this PR.

@Alonely0
Copy link
Contributor Author

Alonely0 commented Jan 5, 2026

I don't know of a way that you can read the pipe signals to be able to handle the ignore signals and flags without it being overriden by the rust runtime without reading them in the .data_init section. Theres an implementation of it here: #9657

I think it would be much simpler to take this approach than whats in this PR.

Oh, I didn't know about this. The thing is, timeout needs to scan all the signal space and block ignored ones to conform to GNU (something this PR is introducing), so I guess the best option is to just code in a special case for SIGPIPE that uses that approach. However, this PR has become quite expansive because it's fixing multiple bugs and adapting to new GNU behavior, so I guess it sticks.

Also added a test case for it.
@Alonely0 Alonely0 force-pushed the timeout branch 2 times, most recently from 47d9aaa to 4004771 Compare January 5, 2026 19:07
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

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

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/follow-name is no longer failing!

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

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

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

GNU testsuite comparison:

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

@Alonely0
Copy link
Contributor Author

Alonely0 commented Jan 6, 2026

I swear macOS CI is so (demoralizingly) petty it has internal failures in purpose when it knows it's gonna pass lmao.

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.

5 participants