Newlines and other special characters in Unix filenames
Did you ever wonder why Unix allows newline characters in filenames? Did you ever run into the problem where filenames that start with "-" cause problems with commands like rm? Have you ever created a directory full of files whose names were entirely just strings of " " (space) characters of varying lengths?
Unix allows filenames to be any arbitrary sequence of bytes, except '\0' and '/'. Fixing Unix/Linux/POSIX Filenames, by David A. Wheeler, is an essay about why it shouldn't.
To be honest, when I first followed a link to that essay, I was expecting to disagree. After all, the extreme flexibility of Unix filenames is a feature, not a bug! Writing programs and doing experiments is so much easier when your operating system doesn't make arbitrary restrictions!
But after reading the whole thing, I'm convinced. At the very least, disallowing characters 0x01-0x1f in filenames is completely sane, and would solve all kinds of problems with Unix scripting. It would make programming easier.
- Restricting filenames: "Programs assume it, standards permit it,
operating systems already do it."
-- David A. Wheeler
But no, prohibiting files from being named "com1.txt" for historical reasons (which Windows does - try it!) is still not okay.
Why would you follow me on twitter? Use RSS.