fix(search): use xargs -0 for null-delimited filelist to handle space…#701
fix(search): use xargs -0 for null-delimited filelist to handle space…#701naman616 wants to merge 1 commit into
Conversation
…s in path (DeusData#670) write_scoped_filelist wrote newline-delimited absolute paths; BSD xargs split each entry on whitespace, so a space in root_path (e.g. /Users/John Smith/...) caused grep to receive broken path fragments, silently producing zero matches. Fix: write null-delimited paths (fputc '\0') and invoke xargs -0 so each path is passed as a single argument regardless of embedded spaces or metacharacters. Also add -H to the non-scoped grep -rn fallback so BSD grep always emits the filename prefix that collect_grep_matches requires. Regression test: search_code_space_in_path_issue670 creates a project rooted at a directory containing a space, inserts an indexed node, and asserts that search_code returns a match — reproducing the exact reported failure scenario. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: naman616 <namanlodha616@gmail.com>
ef1e7a2 to
5df9173
Compare
|
Huge thanks for opening this PR and for the work you put into it. The maintainer shop is currently full, so this may sit for a bit before it gets a proper review. We will come back to this as soon as possible with real feedback; I wanted to make sure it did not sit unacknowledged in the meantime. |
|
Thanks, this looks focused. Before merge, please rewrite the commit metadata to remove generated/co-author/session attribution. DCO otherwise appears to be present on the non-merge commit. |
|
Thank you for digging into #670 — your diagnosis of the newline-delimited filelist breaking on spaced paths was correct. While this was open, the same class got fixed on main via 3dd2471 (#751) plus 32bb56e (-Hn), with one crucial platform split your CI run surfaced the hard way: Windows' PowerShell Get-Content path can't consume NUL-delimited lists, which is why main keeps newline delimiting there — and why this branch's own Windows job went red. Since the Unix fix is already on main and the unconditional NUL can't ship as-is, we're closing this as superseded. Your instinct on the root cause was right, and we appreciate the regression test shape — the merged version guards the same scenario. Thanks again! |
…s in path (#670)
write_scoped_filelist wrote newline-delimited absolute paths; BSD xargs split each entry on whitespace, so a space in root_path (e.g. /Users/John Smith/...) caused grep to receive broken path fragments, silently producing zero matches.
Fix: write null-delimited paths (fputc '\0') and invoke xargs -0 so each path is passed as a single argument regardless of embedded spaces or metacharacters. Also add -H to the non-scoped grep -rn fallback so BSD grep always emits the filename prefix that collect_grep_matches requires.
Regression test: search_code_space_in_path_issue670 creates a project rooted at a directory containing a space, inserts an indexed node, and asserts that search_code returns a match — reproducing the exact reported failure scenario.
What does this PR do?
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)