fix(ripgrep): use non-scoped temp directory to prevent premature cleanup (#23411)#23412
Closed
kagura-agent wants to merge 1 commit intoanomalyco:devfrom
Closed
fix(ripgrep): use non-scoped temp directory to prevent premature cleanup (#23411)#23412kagura-agent wants to merge 1 commit intoanomalyco:devfrom
kagura-agent wants to merge 1 commit intoanomalyco:devfrom
Conversation
…nup (anomalyco#23411) The extract helper wraps makeTempDirectoryScoped with Effect.scoped, causing the temp directory to be deleted when extract returns — before the caller can check the extracted binary or copy it to the target path. Switch to makeTempDirectory (non-scoped) and manually remove the temp directory after the copy succeeds or on error.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: The search results only return the current PR (#23412 - note the title references #23411, which is the issue number). The only other potentially related result is PR #13514 about memory leaks, which doesn't appear to be directly related to the ripgrep temp directory issue. No duplicate PRs found |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Author
|
Closing this PR — the upstream |
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.
Issue for this PR
Closes #23411
Type of change
What does this PR do?
The
extracthelper inripgrep.tswraps its body withEffect.scoped, so the temp directory created bymakeTempDirectoryScopedgets deleted as soon asextractreturns. The caller then callsfs.exists(extracted)on a path inside that deleted directory and fails with "ripgrep archive did not contain executable".Fix: switch to
makeTempDirectory(non-scoped) and manually clean up the temp directory after copying the binary out, or on error.How did you verify your code works?
Traced the Effect scoping lifecycle:
makeTempDirectoryScopedregisters a finalizer in the current scope;Effect.scopedonextractcloses that scope on return. The caller needs the extracted path afterextractreturns, so the temp dir must outlive the call. Verified the fix preserves cleanup on both success and error paths.Checklist