Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryMakes Stop reach copies waiting for a pipe or a leased file.
No actionable issues were found. Tests were inspected, not run. The full PR was reviewed because the previous review and current head have different merge bases with the target commit.
|
thisisgm
force-pushed
the
stop-read
branch
2 times, most recently
from
November 11, 2026 18:21
c79bc08 to
1557e86
Compare
Copying a pipe nobody writes to waited in open, or in a read, where Stop was never looked for: the copy stayed busy until something wrote. The source is now opened without waiting and asked whether it has anything ten times a second, with Stop read in between. A file under another program's lease, which refuses such an open, is asked for again until the lease is given up or Stop is pressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The small pull request asked for when #29 was closed: Stop now ends a copy that is waiting on a read that never comes. One commit with its tests. No library,
dependsoroptdependsentry is added.What you'd notice
Copy a named pipe that nothing writes to, or a folder that holds one, and press Stop. On main the copy stays busy until something writes to the pipe: it waits inside
openwhen the pipe has no writer, and insidereadwhen a writer is there but silent, and Stop is only looked for between pieces. With this change the copy ends within about a tenth of a second and leaves nothing behind.How
O_NONBLOCK, so opening a pipe with no writer returns at once.QFiletakes the descriptor over and closes it.pollwhether the source has anything, for at most 100 ms (stopCheckMs), and looks for Stop when it has not. A regular file always has its next piece, and a pipe reports its end once its writers are gone, so neither waits there.EWOULDBLOCK). That open is tried again every 100 ms until the lease is given up, with a look for Stop between tries, so such a file is still waited for, and Stop ends that wait too.EAGAINgoes round again, asEINTRalready did.Regular files take the same road as before, with one
pollin front of each megabyte read.Tests
Three new cases; the suite goes from 196 to 199 tests.
fileOpsCancelStopsACopyWaitingOnAPipecopies a pipe twice, once with no writer and once with a writer that never writes. Each time it checks that the copy is still waiting after 300 ms, sets Stop, and expects the copy to end without an error and without a file at the destination. It fails on main, and with either half of the change taken out (an open that waits, or a read that is not asked for first).fileOpsCopyLosesNothingWhenAPipesWriterPauseswrites to the pipe, stays silent for longer than a look for Stop takes, writes again and closes, and expects both pieces in the copy.fileOpsCopyWaitsForAFileUnderALeasetakes a write lease on a file, starts a copy and checks that it waits. Once it gives the lease up and expects the copy whole; once it sets Stop while the lease is held and expects the copy to end with nothing at the destination. It fails when the open is not tried again, and when Stop is not looked for between tries.The two pipe tests already on main (
fileOpsCancelStopsACopyPartwayandfileOpsCopyIsNeverOpenToOthersWhileCopying) pass unchanged.