Thursday, April 24, 2008

What is going on with case sensitivity on *nix systems?

I think I'm going mad (due to my ignorance, since I guess this is known...)!!

On my macosx I made I typo in trying to enter a folder (note that USers doesn't exist):

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][1 ~]
>>> cd /USers/moovida//codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data/

But hey, I could enter:

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][2 /USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data]
>>> pwd
/USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data

So to be sure I didn't do anything nasty in the past, as for example renaming my home folder (which is impossible) or relink it.. or ... or aliens came to take me:

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][3 /USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data]
>>> ll /
total 41029
drwxrwxr-x+ 116 root admin 3.9K Apr 19 10:17 Applications
-rw-r--r--@ 1 root admin 1.0K Nov 18 22:58 Desktop DB
-rw-r--r--@ 1 root admin 2B Nov 15 20:04 Desktop DF
drwxrwxr-x@ 16 root admin 544B Nov 27 00:43 Developer
drwxrwxr-t+ 57 root admin 1.9K Jan 20 23:01 Library
drwxr-xr-x@ 2 root wheel 68B Sep 23 2007 Network
drwxr-xr-x 4 root wheel 136B Feb 13 17:30 System
drwxrwxrwx@ 3 root wheel 102B Dec 13 22:45 TheVolumeSettingsFolder
lrwxr-xr-x 1 root admin 60B Nov 15 15:56 User Guides And Information -> /Library/Documentation/User Guides and Information.localized
drwxr-xr-x 5 root admin 170B Nov 15 15:55 Users

Ha ha, Users is != USers...

[10:04 - Thu_24_Apr_2008 by moovida on moovida-2 ][4 /USers/moovida/codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data]
>>> cd /Users/moovida//codeapisexes/imageiobuild/gdalbuild/gdal1.4.4/data/

Works also... so is the filesystem case sensitive or not?

4 comments:

Anonymous said...

Case sensitivity depends on two things, the OS and the filesystem. So the question is, what filesystem are you using?

EXT2/EXT3 are case-sensitive filesystems, so you can create two different filenames that differ only by case.

FAT32 is not case-sensitive. If I remember correctly, everything gets converted into lower-case.

NTFS, as far as I know, maintains the case of filenames, but I *think* it does not allow filenames that differ only by case. Can't say for sure because I've only used it with Windows, which doesn't care about case anyway.

moovida said...

Hi Ramnath, that is the funny thing, look at this:

>>> mount
/dev/disk0s2 on / (hfs, local, journaled)
...etc

I for some reason was sure that hfs is case sensitive... how wrong I was :)

Anonymous said...

See the wikipedia page on filesystem comparisons:

http://en.wikipedia.org/wiki/Comparison_of_file_systems

Particularly, note the case-sensitivity and case-preservation comparison in the 'Features' section, and note #64.

moovida said...

Thanks for the great link Ramnath, that explains many things :)