4 ms·
Does every program understand filenames with newlines? Or emoji, backslashes, minus signs or invalid UTF-8 sequences?
by tinus_hn 6y ago
Does every program understand filenames with newlines? Or emoji, backslashes, minus signs or invalid UTF-8 sequences?
- m463 6y agoIt took me a long time to figure out why "ls" on one system sorted my filenames differently than "ls" on my other system. (meaning that filename handling with the same program isn't even consistent with itself) Also, what happens when you backup very-important-file.txt and VeryImportantFile.txt and then restore to a case-insensitive filesystem? I'll tell you - unexpected things.
- oarsinsync 6y ago> Also, what happens when you backup very-important-file.txt and VeryImportantFile.txt and then restore to a case-insensitive filesystem? Both files get restored as independent files, as case isnt the only difference in those files. (Did you mean very-important-file.txt and Very-Important-File.txt?)
- m463 6y ago> (Did you mean very-important-file.txt and Very-Important-File.txt?) oh sorry, ha! yes.
- tinus_hn 6y agoBackup applications always need to be aware of the filesystem features. Otherwise they won’t be able to store all important information, such as permissions and extended attributes. By the way, having two files in one directory that would clash on a case insensitive filesystem is a bad idea and pretty unlikely.
- pessimizer 6y agoWhy would "every program" be the threshhold? There is no internal file format that every program understands, why should every program be able to deal with every filename? I could write my program to chunk filenames into words, and choke on any that it can't find in your local dictionary: "Spelling-sensitivity." It would be very bad to put that into the kernel. It's easier to keep things simple, and rely on the program to discard things that it can't or doesn't want to use. If a program wants to insist that "Bob.txt" and Robert.txt" are the same file, that's its prerogative, although it's a dangerous assumption.
- hajile 6y agoThe fundamental question is: can you directly compare bytes? If you can, then how you choose to interpret those bytes is irrelevant. If you cannot, then you must learn when multiple bytes have the same meaning or when a byte in a different context should have a different meaning. The latter case is much more complex for the computer as it requires parsing instead of comparison and is more complex for the programmer as it requires understanding of every supported difference (plus learning new ones as they are added).