Repository navigation
Use base's hDuplicateTo; drop the patched copy - #5117
Merged
VeryMilkyJoe merged 1 commit intoOct 10, 2026
Merged
Conversation
VeryMilkyJoe
approved these changes
Oct 10, 2026
VeryMilkyJoe
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, thank you!
`hDuplicateTo'` copied base's `hDuplicateTo` without its `hClose_help` on
the target: closing the descriptor before `dup2` let another thread reuse
it, and `dup2` failed with `EBUSY`. Base fixed this in GHC 9.0.1 ("Avoid
race condition in hDuplicateTo", ghc/ghc!2318); all supported GHC versions
carry the fix. The copy's `DuplexHandle` case still closed the target.
Removes `hDuplicateTo'` from the API of `Development.IDE.GHC.Util` and
`Development.IDE`.
VeryMilkyJoe
force-pushed
the
dom/ghcide/drop-hduplicateto-copy
branch
from
October 10, 2026 12:55
6f507e8 to
8c18ca6
Compare
VeryMilkyJoe
enabled auto-merge (squash)
October 10, 2026 12:56
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.
Development.IDE.GHC.Util.hDuplicateTo'is a copy of base'shDuplicateTowithout thehClose_helpon the target handle. Closing the descriptor beforedup2let another thread reuse the number, anddup2failed withEBUSY(haskell/ghcide#259). The issue was fixed upstream many years ago ("Avoid race condition in hDuplicateTo"; ghc/ghc!2318; since GHC 9.0.1).The copy in HLS was strictly worse than base: its
DuplexHandlecase still calledhClose_help.This PR:
defaultArgumentswithGHC.IO.Handle.hDuplicateTo;hDuplicateTo'and its copied helpers (dupHandleTo,dupHandle_,ioe_dupHandlesNotCompatible).hDuplicateTo'is no longer exported fromDevelopment.IDE.GHC.UtilorDevelopment.IDE. It wasn't used by anything else in HLS.