2 ms·
1, Return is not a glyph. 2, Never the less, people do actually expect to use even that. And they're not even wrong. It's not their fault that it breaks thing
by Brian_K_White 3y ago
1, Return is not a glyph.
2, Never the less, people do actually expect to use even that.
And they're not even wrong. It's not their fault that it breaks things.
In Windows they get away with it beacause for most users there is no such thing as a command line which is actually at least 2 little programming languages combined with special syntax (the shell itself and readline, and maybe even the tty line discipline and stty settings count as yet a 3rd little dsl in there, maybe even the terminal emulation counts as yet another!).
All input, including entering filenames, even when you have to type them, goes through fully managed input widgets that allow almost everything, and they catch and reject the few things they must right on input.
I've written things that take user input and url-encodes it for the matching filename myself, so that the user can do whatever they want, yet the the filename remains convenient and safe, yet still directly human legible & meaningful unlike base64 or random hashes.
That interface with I guess no less than 4 different layers of special syntax which is a shell, is useful but it's really not something to expect anyone but a programmer or technician to have to deal with. All the cases where a "bad" filename breaks something are just examples of the application's internals leaking out and being exposed to the user, which was always wrong since that's also the basis of all security exploits.
It's like taking that urlencoded data I mentioned and dropping it directly into printf, segfault, and complaining that the user should know better than to include %d in a text input.
- teo_zero 3y agoI don't understand if you agree or disagree with me. When you say that you have written things to encode user input so that no "bad" characters (among which I assume you include CR) end up in the filename, you seem to agree that it's not enough for CR to be in the keyboard for it to be automatically allowed in filenames. Which was my point.