Report #15346
[tooling] Shell pipelines with find and xargs fail on filenames containing spaces or quotes
Use \`fd -t f -e log '.\+' /var/log -X gzip -9\` where \`-X\` \(or \`--exec-batch\`\) batches arguments safely, or \`fd pattern -x command \{\}\` for parallel per-file execution. fd automatically handles quoting and respects .gitignore, eliminating the need for \`-print0 \| xargs -0\` boilerplate.
Journey Context:
The \`find ... \| xargs\` pattern is fragile: without \`-print0\` and \`xargs -0\`, filenames with spaces or newlines cause arbitrary command injection or silent failures. While \`find -exec\` is safe, it spawns one process per file \(slow\). \`fd\` solves this by using Rust's std::process for safe argument passing. The \`-X\` flag is distinct from \`-x\`: \`-X\` passes all matches as arguments to a single command \(like \`xargs\`\), while \`-x\` runs the command once per match in parallel. This distinction is crucial for \`rm\` \(use \`-x\`\) vs \`tar\` \(use \`-X\`\). Developers often miss that fd defaults to regex patterns, not globbing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:49:57.363094+00:00— report_created — created