CC: | Achim Gratz <Stromeko [...] nexgo.de> |
Subject: | Bug in determining case sensitivity on Cygwin |
Date: | Sat, 15 Apr 2017 14:41:52 -0400 |
To: | bug-PathTools [...] rt.cpan.org |
From: | Ken Brown <kbrown [...] cornell.edu> |
The definition of case_tolerant in File::Spec::Cygwin ignores the fact
that file systems can be case sensitive on Cygwin without that
information being visible in Cygwin::mount_flags. See
https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-casesensitive
Starting with Cygwin-2.6.1, case sensitivity can be determined in C code
via the pathconf function with the _PC_CASE_INSENSITIVE flag, as in the
following code snippet [adapted from the emacs sources]:
#include <unistd.h>
bool
file_name_case_insensitive_p (const char *filename)
{
int res = pathconf (filename, _PC_CASE_INSENSITIVE);
if (res >= 0)
return res > 0;
return true;
}
Or it can be determined by the getconf utility:
$ getconf CASE_INSENSITIVE .
0
or
$ getconf -a .
CASE_INSENSITIVE 0
FILESIZEBITS 64
LINK_MAX 1024
NAME_MAX 255
PATH_MAX 4096
PIPE_BUF 4096
POSIX2_SYMLINKS 1
POSIX_PERMISSIONS 1
POSIX_SECURITY 1
SYMLINK_MAX 4095
_POSIX_CHOWN_RESTRICTED 1
_POSIX_NO_TRUNC 1
_POSIX_ASYNC_IO undefined
_POSIX_PRIO_IO undefined
_POSIX_SYNC_IO 1
Ken