5 ms·
> because spaces are a reasonable thing to put in a filename unless you're on a Unix system. Putting spaces on a filename is atrocious and should be disallowed
by enriquto 6y ago
> because spaces are a reasonable thing to put in a filename unless you're on a Unix system.
Putting spaces on a filename is atrocious and should be disallowed by modern filesystems. It is like if you could put spaces inside variable names in Python. Ridiculous.
- outadoc 6y agoYou should take a stroll in the real world sometime, where spaces and Unicode exists :)
- enriquto 6y agoYeah, any unicode character is OK on a filename, except maybe space and slash.
- skissane 6y agoI don't think C0 or C1 controls should be allowed in filenames. Why allow them? And they potentially pose security issues. With some, admittedly somewhat obscure [1][2], terminal emulators, C0 and C1 controls can even be used to execute arbitrary code. You could say these terminal emulators are insecure, and you may well be right, but the fact is they exist. [1] See for example page 211 of https://static.zumasys.com/zumasys/atfiles/manuals/at7/AccuTerm-7-User-Manual.pdf https://static.zumasys.com/zumasys/atfiles/manuals/at7/AccuT... which documents the ESC STX < command CR escape sequence which tells the AccuTerm terminal emulator to run an arbitrary command [2] Also the APC C1 control can make Kermit run arbitrary commands, if you've executed "SET APC UNCHECKED" (which is not the default setting) – see http://www.kermitproject.org/onlinebooks/usingckermit3e.pdf http://www.kermitproject.org/onlinebooks/usingckermit3e.pdf page numbered 300 (page 310 of PDF)
- nerdponx 6y agoI agree. Personally I think the Linux kernel should have a compilation-time option to disallow various special characters in filenames such as ASCII control characters and colons, so users who want to maintain a sane system can give themselves the option to do so.
- enriquto 6y agoand spaces! ;)
- AnIdiotOnTheNet 6y agoSo um, how would you work with files that came from a foreign file system? Would the kernel just crash when it sees them? Would they be effectively untouchable, like filenames with a '/' encoded in them?
- skissane 6y agoPreviously, I proposed addressing this with a mount option and a filesystem volume flag [1]. The mount option would prevent creating new files/directories with "bad names" but would still allow accessing ones which already exist. The filesystem volume flag would make bad names on that volume be considered fsck errors. (If the kernel found such a bad name on a volume with the flag enabled, it should log that as a filesystem error, and either return an IO error, or just pretend the file doesn't exist – whatever Linux does now when it finds a file on disk whose name contains a null byte or forward slash.) Using a mount option and/or filesystem volume flag means it works fine with legacy volumes which might contain those bad names. On such legacy volumes, either that volume flag is not supported by the filesystem, or else it is but is disabled for that particular volume. If you mount it with the mount option, you can still access bad names on that volume, you just can't create new ones; if you need to create new bad names, you just (re)mount it with the mount option disabled. [1] https://news.ycombinator.com/item?id=22873153 https://news.ycombinator.com/item?id=22873153
- gorgoiler 6y agoThe parent comment is extreme, and the real world is indeed very diverse, but I would also be quite surprised to find a software project with spaces in internal filenames.
- outadoc 6y agoSo would I, but the world is, thankfully, not entirely composed of software projects.
- HeadsUpHigh 6y agoI'm not going back to CamelCase or underscores for my normal day to day file naming. The problem with spaces only exists inside the IT world and it's something they should find a way around.
- enriquto 6y agoI agree. The file load/save dialogs of all GUI should work in such a way that spaces typed by the users in a filename field are always transparently changed to something different (for example, the unicode non-breaking space).
- skissane 6y ago> (for example, the unicode non-breaking space) That's potentially even worse in a file name than plain old space is. It looks like a normal space, but isn't. If you are going to replace spaces in file names with something else, underscores are the best option I think.
- HeadsUpHigh 6y agoSounds like taking the "I know better than the users to another level".
- jyounker 6y agoAt the point I'd be happy if all unix tools had a `--json` option. Then the whole space issue goes away. So do a bunch of parsing issues. Unix tools standardized a character representation (e.g. everything is ascii). The next step is a unified standard the syntactical representation.
- laumars 6y agoASCII isn’t just a “character representation” though. It includes code points for data serialisation and transmission control. You can represent tables in ASCII without resorting to printable characters nor white space as field separators. I don’t why POSIX tools don’t already do this but I suspect it’s because most tools would have evolved by accident rather than being designed from the ground up with edge cases in mind.
- necrotic_comp 6y agoAt Goldman, the internal language Slang has spaces in variable names. It's insane at first glance and I got into an argument with my manager about why in the world this was acceptable, and he could give me no other answer than "this is the way it is". But when you realize that space isn't a valid separator between token, seeing things like "Class to Pull Info From Database::Extractor Tool" actually becomes much easier to read and the language becomes highly expressive, helped somewhat by the insane integration into the firm's systems. I was on your side until I tried it, but it can actually be quite useful, esp. if everything is consistent.
- enriquto 6y ago> I was on your side until I tried it, but it can actually be quite useful, esp. if everything is consistent. On my side? You cannot imagine how extreme one can be... If I had my way, programming languages would only allow single-letter variables and space would be the multiplication operator.
- nerdponx 6y agoWhat possible justification could you have for making this mandatory? Math notation being dependent on single-character names is an artifact of "concatenation as multiplication" -- which in my opinion is a useful but sloppy historical convention with little merit or relevance in non-handwritten media.
- necrotic_comp 6y agoOkay - I wasn't meaning to pick a fight here. Just saying that there are definite use cases where spaces in variable names can work and actually be useful. That's all.
- nerdponx 6y agoI disagree with this immensely. Also, some languages do allow whitespace in variable names like R and SQL, so long as the variable names are quoted or escaped properly.
- tomaskafka 6y agoAre your kids named NameSurname? Did you meet EuropeanBrownBear on your last trip to the mountains? :)