3 ms·
Run a program to list a directory. Everything that interfaces with that, will assume newline delimiters. Similar assumptions are baked into a lot of software.
by shakna 2y ago
Run a program to list a directory. Everything that interfaces with that, will assume newline delimiters. Similar assumptions are baked into a lot of software.
Enforcing that a newline isn't part of a path, ensures the security of those systems that are commonly relied on.
- oguz-ismail 2y agoExcept no one's enforcing anything yet. Earlier versions of POSIX allowed rejecting filenames containing newlines, the newest version encourages it while mandating features required to handle such filenames safely (find -print0, xargs -0, read -d ''). So nothing's set in stone yet.
- IshKebab 2y ago> Everything that interfaces with that, will assume newline delimiters. Well, only badly written programs. nushell handles this fine, as will any program that doesn't try to do everything as plain strings: ~> touch "foo\nbar" ~> ls foo* | print ╭───┬──────┬──────┬──────┬──────────╮ │ # │ name │ type │ size │ modified │ ├───┼──────┼──────┼──────┼──────────┤ │ 0 │ foo │ file │ 0 B │ now │ │ │ bar │ │ │ │ ╰───┴──────┴──────┴──────┴──────────╯ However after reading it they're only making them illegal for the posix utilities from the 70s that aren't written properly, so I think that makes sense.