Liste des Groupes | Revenir à col misc |
"Carlos E.R." <robin_listas@es.invalid> writes:I think what he meant wasOn 2025-05-07 12:00, Richard Kettlewell wrote:I’m not sure what you mean. First, no quotes need escaping.Forbidding newlines in extfs and its successors would be>
straightforward indeed - no harder than forbidding ‘/’ in
filenames. But as well as swimming against the Unix tide it wouldn’t
actually eliminate the higher-level problem that shell copes badly
with filenames with spaces, newlines, etc, since there’s more to life
than Linux’s native filesystem. Early versions of Linux used the
Minix filesystem, and today the kernel includes a large collection of
‘foreign’ filesystems.
>
Using almost any other language than shell, on the other hand, makes
the problem go away.
Except if you hardcode a filename inside a C program, for
instance. You still have to escape the quotes.
FILE *fp = fopen("whatever\n", "r");
i.e. the normal way of representing newlines in C programs.
Second, the issue in shell is is that newlines (or spaces) interactWell nothing prevents you from using an array of unsigned bytes so you *can* include nulls.
badly with its approach to string handling: a filename can cause a
script to unexpectedly fail. For all that C has truly awful string
handling, it doesn’t go awry just because there’s a space or newline in
a string that it’s working with.
(Strings with nulls in are another matter, but not relevant to filenamesWell again, how do you process a Jpeg read into a program? Or a raw disc sector, or a stream of comms containing binary data?
in Unix filesystems, and AFAIK not common anywhere either.)
Les messages affichés proviennent d'usenet.