On Jun 20 13:33, Sebastian Feld wrote:
> On Fri, Jun 20, 2025 at 12:03 PM Johannes Schindelin
> <[email protected]> wrote:
> >  winsup/cygwin/path.cc | 21 ++++++++++++++++-----
> >  1 file changed, 16 insertions(+), 5 deletions(-)
> >
> > diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
> > index 42919a7cf5..ed08398930 100644
> > --- a/winsup/cygwin/path.cc
> > +++ b/winsup/cygwin/path.cc
> > @@ -1855,9 +1855,18 @@ symlink_native (const char *oldpath, path_conv 
> > &win32_newpath)
> >        while (towupper (*++c_old) == towupper (*++c_new))
> 
> 1 unrelated issue:
> I think this towupper() code is WRONG if the filesystem (e.g. WSL) is
> case-sensitive!

The preceding comment tries to explain why we always compare case
insensitive.  There's a high probability that the symlink will be used
by native (non-Cygwin) processes which are insensitive.

> How can code in cygwin.dll test whether the current path is on a
> case-sensitive volume, or not?

There's a twist here.  NTFS or ReFS or other filesystems (but not FAT)
are usually case sensitive.  It's the OS which makes them case insensitve
by using a specific flag at open time, combined with a kernel registry
key.  So apart from FAT, the creator of a file decides if it's created
sensitive or insensitive, and the one searching for and opening a file
is deciding if the search/open is sensitive or insensitive.

Also, we're creating the symlink via CreateSymbolicLinkW, which is
probably acting case insensitive anyway...

What if the perr-dir case-sensitive
> feature is ON, should that be probed and handled too?

...unless the symlink is created in a case sensitive dir, I assume.

Right now we don't handle case sensitive dirs in the path_conv code.  We
only check for the kernel registry key and the FILE_CASE_SENSITIVE_SEARCH
filesystem flag.

To add the sensitive dirs to the picture, path_conv() would have to
check every directory on NTFS for
NtQueryInformationFile(FileCaseSensitiveInformation). It would then
set the path_conv::caseinsensitive flag accordingly.


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to