Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1971 introduced a `shellcheck` lint. However, it also introduced some bugs due to adding quotes in a few places where word splitting was used. Thanks to gleasonk@ for spotting this: #1976 As described in https://www.shellcheck.net/wiki/SC2086, quoting is generally preferable when expanding a variable. However, when building a command line it is better to create an array and then expand the array. When using a regular variable, quoting can actually lead to incorrect behavior: for example, given `x="file1 file2"`, `clang-format $x` will correctly call `clang-format` on `file1` and `file2`, however `clang-format "$x"` will call `clang-format` on a non-existent file called `file1 file2`. The lint itself was actually broken because of using `-printf '%P\0'` with `find`. This produces null-delimited output, which `mapfile` does not expect and does not parse correctly (only the first file name will be extracted). (While implementing the check I thought I needed to use `printf` to remove the the `./` prefix introduced by `find`, but turns out that's not the case). While investigating this change I discovered that the whitespace lint check is also subtly broken. Indeed in `get_source_files` `xargs` is used at the end of the pipeline, which puts everything on one line, which causes subsequent uses of `xargs -L1` to behave incorrectly (the underlying command is executed only once with all files as arguments).
- Loading branch information