Repository navigation
Conversation
…eusData#2634) Signed-off-by: tahodev <85001874+tahodev@users.noreply.github.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thank you, @tahodev, for this second hardening step and for the clear write-up. We have made the direction call: we want the argv-based helpers, so the search path no longer goes through /bin/sh at all - defence in depth on top of the validator that already guards the shell path. One change to the shape, so we do not end up with a third scanning mechanism: instead of running grep in chunks of 256 files, please feed the file list (the find / sort output) into the existing in-process scanner, Two small things the linters will ask for anyway:
Main has also moved since your last push, so a merge of current main will be needed. If you would rather we make these changes ourselves on your branch, just say so here; maintainer edits are enabled and we are happy to push them with an explanation of each commit. Thanks again for pushing this forward. |
…of chunked grep Signed-off-by: tahodev <85001874+tahodev@users.noreply.github.com>
Signed-off-by: tahodev <85001874+tahodev@users.noreply.github.com>
5ba6a81 to
9a0742e
Compare
Signed-off-by: tahodev <85001874+tahodev@users.noreply.github.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you, @tahodev, for turning this around so quickly and for taking the in-process route exactly as we asked. Feeding the find / sort list straight into search_scan_in_process means indexed and unindexed roots now share one matcher, and the POSIX search path no longer runs a shell at all. The memory-core count for src/mcp/mcp.c did not grow, and you even tightened its baseline to the real count. Main had changed src/mcp/mcp.c since your last push, so we merged current main into your branch (no conflicts) to get a fresh run on the combined tree. Please pull the branch before pushing again so the merge commit is kept. We will merge once the required checks are green. Thanks again - the git helpers are very welcome in the same shape whenever you get to them. |
Disclosure: this pull request was written with AI assistance on behalf of the account owner, who reviews and certifies every commit (DCO sign-off).
Summary
Implements the first phase of #2634 for the
searchpipeline: on POSIX, the unscoped code-search scan no longer builds a/bin/sh -ccommand string. Instead it runs as three supervised argv stages using the existing argv-based subprocess API:find <root> -type f [-name <file_pattern>] -print0writes the NUL-delimited candidate listsort -zunderLC_ALL=Corders the list in placegrep -Hn -E|-F -f <pattern_file> -- <files...>scans it in chunks of 256 files per invocationgrep exit status 1 (no matches in a chunk) is an ordinary empty result, and an empty file list short-circuits to an empty success without spawning grep — the same contract the retired xargs wrapper encoded.
What does not change
mcp_run_argv_stage_cancellable_boundedrunner reusescbm_subprocess_spawn/cbm_subprocess_pollwith the same cancellation latch, deadline handling, and cumulative output-limit latch as the existing shell runner, so cancel/deadline/oversized-output semantics are unchanged. find/sort failures fail closed, exactly like the old pipeline's status checks.system()/popen()/fork()calls — everything goes through the existingcbm_subprocess_*API, so the security allowlist is untouched.The git helpers are left for a follow-up PR to keep this one under the project's size guidance.
Tested
build/c/test-runner mcp(ASan+UBSan, x86_64 Linux): 383 PASS / 0 FAIL, including the existingsearch_code_recursive_fallback_propagates_discovery_failuresfamily (discovery/sort failure propagation, no-match success, empty discovery), which now runs through the argv stages.tests/test_mcp.c, each on an unindexed project so the unscoped argv scan is exercised end to end:$,;) is discovered and searched literally;"total_grep_matches":0;file_patternreaches find as a-nameoperand, so a non-matching extension is excluded and the same search without it matches.make -f Makefile.cbm testrun does not complete in my 2 GB sandbox — the ASan/UBSan process is OOM-killed partway through (4,350 tests passed, 0 failures at the kill point, across the mcp, cross_repo, index_resilience, fqn, route_canon, path_alias, watcher, lz4, zstd, sqlite_writer, artifact, scope, type_rep and go_lsp suites). No failure was observed in any suite that ran; I'm relying on CI for the complete run.Not tested
scripts/lint.sh(no cppcheck/clang-format toolchain available in my environment).Closes first phase of #2634.