3 ms·
The fact that Unix tools have trouble with spaces in filenames is absolutely a problem with Unix. If the Unix ecosystem had better support for this, then it wou
by pcwalton 9y ago
The fact that Unix tools have trouble with spaces in filenames is absolutely a problem with Unix. If the Unix ecosystem had better support for this, then it wouldn't be a problem.
- v_lisivka 9y agoUnix tools have no trouble with space in file names. "-", "\0", "\n" and bad Unicode are troublesome. Lazy programmers can forget to put quotes around variables in shell scripts, but it's not a problem of the tool.
- eigengrau 9y agoAdditionally, not every shell expands variables the way Bourne-based shells do.
- eigengrau 9y agoI don’t quite see how Unix tools have trouble with spaces in filenames. Could you detail some cases where the space handling is not due to the shell, as opposed to the program being invoked?
- mnarayan01 9y agoThere's this program called make...
- eigengrau 9y agoMy question was aimed at ops generic statement. As for Make, it originally wasn’t clear to me where the issue was supposed to lie. Lines in rule bodies are handed off to the shell, and that whitespace in rule dependencies need escaping didn’t seem surprising since it’s a list (though it’s probably a bug that whitespace in target names must be escaped, since it’s just one token that ends in a colon). But I see now that the expansion of list-valued automatic variables is probably a real Make-endemic issue.
- mnarayan01 9y ago> though it’s probably a bug that whitespace in target names must be escaped, since it’s just one token that ends in a colon It's perfectly fine for a rule to have multiple targets, e.g. output.txt error.txt: source build source > output.txt 2> error.txt
- eigengrau 9y agoInteresting! So in that case one could defend the need for escaped whitespace. Still leaves automatic variables, I guess.
- mnarayan01 9y agoWell it could be rewritten to use 0x1f (i.e. unit separator) to separate items. I mean it already has significant tabs. Though invariably people would be like "How is it acceptable for make to not support filenames which contain unit separators? It's 2020 guys, get with the program!"