4 ms·
Maybe the kernel should be fixed to refuse filenames with newlines in them, if there are no other use cases…
by Filligree 2y ago
Maybe the kernel should be fixed to refuse filenames with newlines in them, if there are no other use cases…
- inopinatus 2y agoThe option (and it would have to be an option) to do so doesn't sound like an unreasonable defense-in-depth measure, but given the myriad Unix and Unix-like variants in the world, and the possibility that your code may not be running on such a configured target system[1], we still end up having to have adequately defensive basic coding standards. Honestly, though, it's one reason I write a lot of my own scripts in zsh these days. Zsh has its own quirks, and I don't touch oh-my-zsh with a barge pole, but it's a darn sight quicker to reason about expansions in zsh code compared to bash, especially if arrays are in the mix. Unfortunately zsh is not necessarily available everywhere and certainly remains outside the base install of many *nix distros. [1] we can prove the existence of at least one such device, by construction: it's the CI/CD host on which tests run, because those tests themselves may specifically and intentionally be for safe handling of such filenames, and therefore rely on being able to instantiate them
- SAI_Peregrinus 2y agoRather, the POSIX specification should be fixed to exclude `\n` from filenames, instead of just `/` and `\0`.