4 ms·
Why do you want to put LF bytes into filenames? Using magic, I've renamed any files you have to remove control characters in the name and made it impossible to
by billpg 2y ago
Why do you want to put LF bytes into filenames?
Using magic, I've renamed any files you have to remove control characters in the name and made it impossible to make any new ones. (You can thank me later.)
What can't you do now?
- tredre3 2y agoPreventing certain characters in filenames would solve a lot of issues, from security issues to wasted time all around. But for whatever reason, when it is suggested, you get many people chiming in that "filenames should be dumb bytes, anything allowed except / !"
- hifromwork 2y ago>But for whatever reason, when it is suggested, you get many people chiming in that "filenames should be dumb bytes, anything allowed except / !" I guess the issue is not what filenames should be, but what filenames are. In general, when interacting with files, you have to expect everything but `/` and nullbyte. Even if you forbid it on your machine, someone may mount a NFS drive and open you to the world of weird filenames. And you never know who uses your code. And the unicode itself is weird anyway - for example you may have normalised and denormalised names which may be the same or different string depending on how you look at them[1]. And I hope you are not planning to restrict filenames to some anglocentric [a-z0-9_- ]*, because the world is much larger and you can't pretend unicode doesn't exist. [1] https://eclecticlight.co/2017/04/06/apfs-is-currently-unusable-with-most-non-english-languages/ https://eclecticlight.co/2017/04/06/apfs-is-currently-unusab... and many other cases
- arp242 2y agoLatest POSIX "encourages" implementations to forbid using newlines in pathnames. https://austingroupbugs.net/view.php?id=251 https://austingroupbugs.net/view.php?id=251
- dTal 2y agoI've put a file in my home directory named the entirety of your comment, newline included. Unfortunately I had to trim "except / !" to bring it to 255 characters. Now at least when some tool or pipeline blows up horribly, it'll be hilarious.