Report #24354
[tooling] Piping ripgrep results to xargs fails on filenames containing spaces, newlines, or quotes
Use \`rg -0 -l 'pattern' \| xargs -0 -I \{\} cmd \{\}\` where \`-0\` \(or \`--null\`\) outputs null-delimited filenames and \`xargs -0\` reads them safely using the null byte delimiter.
Journey Context:
Standard \`rg -l \| xargs -I \{\}\` splits on whitespace by default, breaking when matching files contain spaces, quotes, or newlines, causing 'file not found' errors or arbitrary command execution. Using \`-0\`/\`--null\` makes ripgrep terminate each filename with a null byte \(the only character illegal in filenames\), and \`xargs -0\` uses that delimiter. This is the only robust way to process arbitrary filenames found by ripgrep in shell pipelines.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:17:21.839710+00:00— report_created — created