Some text files missing final newlines
I have noticed some MRs recently that touched files with missing trailing newlines.
Missing trailing newlines should be handled correctly by everything, but they are messy, showing up in diffs, and some ad-hoc shell runes or obscure tools may mishandle them. ISTM that we ought to correct these, and have our CI spot them.
zealot:arti> git-ls-files | xargs grep -Pz -L '\n$' 2>/dev/null
.cargo-husky/hooks/pre-push
arti-corpora
crates/tor-llcrypto/testdata/tor.der
crates/tor-llcrypto/testdata/tpo.der
crates/tor-rtcompat/src/test.pfx
crates/tor-units/Cargo.toml
maint/shellcheck_all
zealot:arti>
I think we can identify files that are meant to be binary by their file extension - #309 (closed) notwithstanding, since we don't intend to commit binary executables, only binary data files, or textual script executables. So some suitable git ls-files ':!*.der
etc. etc.` might work.
I'm not sure if grep -Pz -L '\n$'
is at all a sensible approach. Its defect would be to tolerate a file with no trailing newline, if that file also contained a nul byte in the right place. That seems an unlikely scenario.