Uh oh!
There was an error while loading. Please reload this page.
fix(ripgrep): handle broken symlinks gracefully in files() stream - #24973
fix(ripgrep): handle broken symlinks gracefully in files() stream#24973aaronkyriesenbach wants to merge 1 commit into
Conversation
Ripgrep exits with code 2 when it encounters soft errors like broken symlinks or permission-denied paths, even though valid results are still written to stdout. The search() function already handled this, but files() treated exit code 2 as fatal — discarding all results. Add --no-messages to suppress stderr warnings in filesArgs() (matching searchArgs) and treat exit code 2 as non-fatal in the files() stream. This fixes the glob tool silently returning zero results when any broken symlink exists in the search tree.
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes#24972
Type of change
What does this PR do?
The glob tool silently returns zero results when any broken symlink or permission-denied path exists in the search tree. This happens because
Ripgrep.files()treats ripgrep exit code 2 as fatal — it discards all valid stdout output and fails the stream.The
search()function (used by the grep tool) already handles this correctly: it passes--no-messagesto suppress stderr warnings and treats exit code 2 as non-fatal.files()was missed.This PR brings
files()in line withsearch():--no-messagestofilesArgs()so stderr warnings about broken symlinks don't pollute output.files()stream so valid results already emitted to stdout are kept instead of discarded.How did you verify your code works?
files returns valid results despite broken symlinks) that creates a directory with a real file and a broken symlink, callsrg.files()withfollow: true, and asserts the real file is returned.bun turbo typecheck).rg --files --followreturns the target file on stdout but exits with code 2, which the unpatchedfiles()would treat as fatal.Screenshots / recordings
N/A — not a UI change.
Checklist