Re:The History and rationale of the Python 3 Unicode model f...
by gary_0 on Wednesday December 14, 2022 @03:37PM
(#33990142)
Nobody's keyboard even has a "null" key, so in order to specify garbage-bytes filenames you have to resort to programmatic shenanigans anyways, which means you either have a bug or a malicious programmer. In which case you're going to have to break out specialized tools to fix your broken filesystem--or if you're lucky, you can just delete the directory and start over.
Otherwise, you just want filenames you can pipe straight to text in front of the user, who in any case is going to have no idea what to do with a file named ���.txt.
Re:The History and rationale of the Python 3 Unicode model f...
by comex on Thursday December 15, 2022 @12:10AM
(#33995493)
> why probably 90% of shell scripts fail to properly handle file names. Is this what we want?
If you want to fix shell scripts, you need to ban not just newlines but also spaces. Well-written shell scripts handle spaces properly, but many don't, and Makefiles cannot.
Yeah, an FS could say that¹. Alternatively, it could say that names are intended to be read by humans, and that names should be a single line, to support things that people reasonable expect to be able to do with a file system, like being able to list the files on the filesystem, without whatever is doing the listing needing to decide if it is going to just say "I can't display raw bytes, obviously, so here's a best-effort of ���.txt" or if it has to invent some sort of grammar to encode/escape bytes into text.
I.e., a file system is meant to solve a problem, which is the storage and organization of data, and from that, that names are meant to used by humans is one of the requirements of both the OS & the filesystem. (The OS, as it presents the file hierarchy to userspace, e.g., in the VFS, and the filesystem, as it of course needs to store the data.)
By your logic, we should permit nul and '/' in file names, too.
¹and, I mean, most do. Which is why we're in the situation we're in, and why languages are faced with a barrel of bad choices, and why probably 90% of shell scripts fail to properly handle file names. Is this what we want?