This question occurred to me the other day when I was working on a development project that relies on an opinionated framework with regard to file names. The framework (irrelevant here) wanted to see upper-case-first filenames. This got me thinking.
On a case-insensitive file system, say extFAT or HFS+ (specifically non-case sensitive) how does the file system provide access to the same file with both upper and lower case versions of the filename.
$ cd ~/Documents $ pwd /home/derp/Documents $ cd ../documents $ pwd /home/derp/documents $ cd ../docuMents $ pwd /home/derp/docuMents $ cd ../DOCUMENTS $ pwd /home/derp/DOCUMENTS $ cd ../documentS $ pwd /home/derp/documentS
All of these commands will resolve to the same directory. Is this behavior, specifically the output from
pwdjust a function of
bash in this case just showing me what it thinks I want to see?
$ ls ~/Documents Derp.txt another.txt whatThe.WORLD
The filesystem here reports the case of the original filename as created by the user or program.
At what point in the filesystem stack is the human readable filename preserved as it was created (eg. upper and lower case) so that it can be accessed by any combination of the correct upper and lowercase ASCII characters? Is this just a regex trick somewhere or is there something else going on?
EDIT: It looks like the behavior I am curious about is found in case-preserving case-insensitive filesystems after some more research...