Hacker News new | ask | show | jobs
by ninkendo 1248 days ago
Windows did it (“Program Files”, “Documents and Settings”, etc) specifically because they wanted typical developers to be forced to deal with it.

A typical user who is not a developer and has no idea about the semantics around quoting for shell arguments, etc, should absolutely be allowed to put spaces in their filenames. Imagine telling your grandma that she can’t call her word document “Cookie Recipe”… Heck, macOS allows slashes in filenames (at least in Finder… although they turn into `:`s in the actual filesystem), because a lot of people type dates into their document names, using e.g. `1/11/23` notation.

Putting spaces the system directories made it more likely that developers would find these bugs sooner, which IMO isn’t an entirely bad idea.

3 comments

It should force devs to do that, but at some point the service runner got some smarts put into it and you do not need to quote the path to your service's executable. You can drop your own exe at the substring location and leverage it for persistence or privilege escalation to SYSTEM if that location happened to be writable for non-admins.
> Windows did it (“Program Files”, “Documents and Settings”, etc)

And then reverted back. “Documents and Settings” now links to "Users", and new directories were given names like "ProgramData". or "WindowsApps".

Correct, although “Program Files” and “Program Files (x86)” are still primary paths IIRC. (“Documents and Settings” is an alias to “Users” now, but I don’t think they did a similar thing to “Program Files”, although I could be wrong, I don’t have a windows system handy.)
You're correct. And they didn't "revert", as GP is saying, but rather added junction points such that "C:\Documents and Settings\All Users\Application Data" is the same as C:\ProgramData, and that junction point was, at least based on my contacts at Microsoft at the time, more added because Microsoft devs were getting annoyed trying to `cd` there than anything else (i.e., explicitly not a repudiation of forcing devs to deal with spaces). The fact it was introduced only in Windows Vista, after everyone'd been forced to deal with it, was intentional.
Arguably they didn't force anything on developers, I wrote scripts for work for a good while and could use PROGRA~1 or DOCUME~1 to access the files in personal folders since the spaces gave me a headache and I switched between my computer (English locale) and work's computer (Spanish locale), this little word hit both computers.