True case-sensitive filenames

Gerald S. Williams
Fri Jan 17 22:07:00 GMT 2003

The Perl File::Spec thread/rant/whatever on the cygwin list got
me thinking. To resolve the Windows case-insensitivity problem
(e.g., "makefile" == "Makefile"), Linda W. seemed to suggest
creating a new file system driver with a special Cygwin API.

I don't know if she really meant that or I just misinterpreted
it, but I got to thinking that something like this must already
exist for Windows. Sure enough, you can accomplish it using the
Native API. To see for myself, I created the attached test,
which creates /cygdrive/c/makefile and /cygdrive/c/Makefile.
You can even see both files from Cygwin, but when you try to
access either one, you will always get Makefile (after you
delete it, you get makefile of course).

Filenames already are case-sensitive, but the problem is in the
opening of files under Windows. This is normally done using a
case-insensitive search. The Native API function allows you to
choose and actually defaults to using case-sensitive searching.

Of course, this would only work for Windows NT/2000/XP, but I
think it should be pretty easy to make fhandler_disk_file use
case-sensitive searches when opening files. I think this would
be a big boon for Cygwin, and worth creating slightly different
behavior between NT/2000/XP and 9x/ME. We could even fall back
to case-insensitive searching by default, I suppose.

There is already some precedent for using Native API calls in
the fhandler code: fhandler_dev_raw does it.

Any interest in taking this further?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: create_raw.c
Type: application/octet-stream
Size: 3703 bytes
Desc: not available
URL: <>

More information about the Cygwin-developers mailing list