6 ms·
> paths may contain spaces what kind of savage puts spaces on their paths? Failing in such cases is a neat feature it would seem. I never understood why comm
by enriquto 3y ago
> paths may contain spaces
what kind of savage puts spaces on their paths? Failing in such cases is a neat feature it would seem.
I never understood why common filesystems allow this foolishness. There are already other semantically meaningful characters in paths that are forbidden, like '/' or '\0'. Disallowing bare spaces in filenames is such a natural feature that it makes no sense to deal with all this stupid quoting pain. Any space that is entered by a user in a filename context should be transparently translated to a unicode non-breaking space. Most users wouldn't notice, and shell scripts authors would be much happier!
- rurban 3y ago> what kind of savage puts spaces on their paths? Failing in such cases is a neat feature it would seem. windows noobs (as in embedded development), but more likely grabbed music.
- lifthrasiir 3y agoFailing in the way that it is virtually not fixable (e.g. Windows user names) or destructive (e.g. removing some unrelated directories) is not neat. It is even often said that Windows had a space in `C:\Program Files` (now `C:\ProgramData`) in order to make sure that app developers have to handle paths with spaces correctly. Don't know if it's indeed true, but at least it's believable.
- CorrectHorseBat 3y agoIt's much worse than this. On Unix '\000' (NUL) and '\057' (/) are the _only_ things that are not allowed. Anything else, whether it's valid in any encoding or not, is allowed.
- ykonstant 3y agoIn order to test my shell scripts, I have a directory hierarchy of filenames generated from /dev/urandom, which contains a sub-structure with filenames in unary, using only the newline character.
- lmm 3y ago> I never understood why common filesystems allow this foolishness. Because back in the days of K&R the kernel just blatted out whatever bytes it was given, and the C/Unix folks refuse to even consider that old APIs might have problems and need changing.
- arp242 3y agoBecause space is one of the most common characters in many languages, and people want to write stuff with spaces. > Most users wouldn't notice, and shell scripts authors would be much happier! They would, because people want to use spaces, and they wouldn't, because there's a bunch of characters you need to quote for (in POSIX sh/bash). The solution is to realize it's not 1986 and evolve shell scripting beyond that. Fish and zsh have done that. Probably others as well. It's not even that hard and doesn't even need to woefully break compatibility. Oh, and even if you did somehow convince the Unix world to outlaw spaces and other special shell characters by some super-human feat of charisma, you still haven't really solved anything because there's no way in hell you're going to convince the Windows or macOS people to do that, so you're still going to end up in trouble when your spouse or grandma or boss gives you their USB drive, or sends you files (which you can conveniently no longer store), or whatnot. Might as well argue for the moon to be painted green. It's just not going to happen.
- H4ZB7 3y agoyour entire reasoning is just that your UI (a shell) cant work with spaces. literally unix brain damage. one UI supports this one supports that, neither should have any pressure on how data in the system is formatted. your tool is just broken.
- SAI_Peregrinus 3y agoΤĥιs ñåmè/ įß ą váĺîδ POSIX paτĥ
- enriquto 3y agoLooks good to me. Assuming that the spaces are unicode nbsp.
- bin_bash 3y agoperhaps someone wants to put a script in their icloud directory on macOS: ~/Library/Mobile Documents/com~apple~CloudDocs