Liste des Groupes | Revenir à col misc |
Computer Nerd Kev <not@telling.you.invalid> wrote:Rich <rich@example.invalid> wrote:Computer Nerd Kev <not@telling.you.invalid> wrote:But it means assuming that newlines in filenames won't actually
appear.
Which, in reality, is all but true unless someone is going out of
their way to experiment or be very odd. The only time I've ever
encountered filenames with newlines has been when I've deliberately
created them to verify some bit of code (or to try to break some bit
of code, although verify/break often go hand in hand).
That's my point exactly, all these work-arounds in specific programs
like "find -print0" in GNU Find have been written even though use of
newlines in filenames is so rare.
The -print0 "workaround" as you call it is not there "just for
newlines". Banning newlines would not help with the need for -print0.
-print0 also helps with preventing all the other shell metacharacters
and spaces from also causing trouble when piping filenames through all
the various tools.
We'd have been better off with newlines forbidden in filenames so
that all the special handling just for the sake of someone "going out
of their way to experiment or be very odd" could be avoided.
Probably more secure against people hacking software whose authors
didn't think about it too.
Forbidding newlines would not fix the need for -print0. You'd also
need to forbid an entire host of printable characters (many of which
unsuspecting users will try to use, such as ASCII single quote ' for a
contraction in a filename). You'd either need to ban things like '
and $ and " and others - and as soon as you go down that path it's
almost a bottomless hole until you've banned everything but [a-z0-9.].
Yes it's too late to change now, _someone_ will be using filenames
with newlines in a major way, but I'd say the same about the case
insensitivity feature which "Torvalds Hates".
I very much doubt anyone actually "uses newlines" in a filename (other
than for testing that something does not break when they are
encountered).
Les messages affichés proviennent d'usenet.