Repository navigation
Conversation
Searching a directory that contains /dev (e.g. path=/) never returned because ripgrep walked the whole target and read device nodes, and the Python fallback opened every listed file. - rg: add --one-file-system - walk_entries: skip directories on a different device than the root - match_files: only read regular files (is_regular_file / S_ISREG) Fixes open-webui#185
…s and CI workflow Covers issue open-webui#185: FIFO stand-in for blocking device nodes (Python fallback and ripgrep paths), device-boundary skipping in walk_entries, --one-file-system being passed to ripgrep, and is_regular_file. Adds a GitHub Actions workflow that runs pytest with ripgrep installed.
Author
Verification results and CI evidenceI reran the before/after sandbox checks against base GitHub Actions on the fork
Before/after regression checks
LimitationThe reporter's exact Debian 13/LXC + ripgrep 14.1.1 |
Author
|
Hi @tjbck, would you be able to review this PR when you have a chance? Thanks! |
This branch has not been deployed
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.
Fixes #185.
GET /files/matchesnever returned when the search directory contained/dev(e.g.path=/). ripgrep was given the whole target directory and read device nodes, which block forever. The Python fallback also opened every listed entry.Changes
utils/search.py: add--one-file-systemto thergarguments inmatching_files.utils/search.py:walk_entriesskips directories on a different device than the search root (skips/dev,/proc,/sys).utils/search.py: newis_regular_file()helper (stat.S_ISREG).main.py:match_filesonly reads content from regular files, so device nodes, FIFOs and sockets are never opened (also coverspath=/devgiven directly).tests/(13), aTestsGitHub Actions workflow (Python 3.11 and 3.12, ripgrep installed), and a changelog entry under[Unreleased].Testing
python -m pytest -q tests: 13 passed.path=/devand a FIFO with no writer timed out on the old Python fallback but returned promptly with this change. The FIFO regression was not reproduced with ripgrep; the reported ripgrep hang on/devwas not reproduced in this environment./files/matcheson a Linux sandbox: searches of/complete with this branch, taking 8.93s as root and 39.37s as a normal user with ripgrep, and 41.56s as root and 44.84s as a normal user with the Python fallback. The old Python fallback timed out on/after 45s.See the verification comment below for detailed timings and CI links.
The docs note about recommending ripgrep from the issue is not included.