[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)
Nikolaos Chatzikonstantinou via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 9 22:01:55 PST 2025
createyourpersonalaccount wrote:
> Diagnostic output should go to stderr, but the informational output of git-clang-format is sent to stdout instead.
What does that mean? The printing of null-terminated paths on stdout is pretty standard on unix utilities. What's "diagnostic" and "informational"?
The `--null` option is so that the paths can be safely handled by other tools in the shell pipeline.
> If you want to run git add in git-clang-format, we can add an option for that.
No, that's limiting to the user. The right thing to do is to print the paths with null-terminated bytes in between, so that any utility wished can be executed.
Are you perhaps not aware of the issues at play here? Paths on linux/bsd/etc can contain any character. It's impossible to parse text output containing paths safely. You have to use some kind of format, and the approach used by all utilities is null-separated paths.
https://github.com/llvm/llvm-project/pull/123926
More information about the cfe-commits
mailing list