www.delorie.com/archives/browse.cgi | search |
DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 55NJlYL83788151 |
Authentication-Results: | delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com |
Authentication-Results: | delorie.com; spf=pass smtp.mailfrom=cygwin.com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 delorie.com 55NJlYL83788151 |
Authentication-Results: | delorie.com; |
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=cG36AMrr | |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 10BC0384671B |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1750708053; | |
bh=RH7hR7h6pAsm4TYx6+8mLObCmF3dHYZn3gwSsdUMIyQ=; | |
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=cG36AMrr20+uIspNbjrustEkmK+Pb29wDpDNr/AySMIsTDnPXupGIfdqrvgwODRzT | |
is9FKOwP/8Q/3r8r0qWvuZsI31uWBo3F4JbdcZIY2TIUqDY0qQhEdkQFu/D6mjZMQf | |
Bia5WuQ9NBoWal6b4AjayNCuBq50euwbqG+94q4s= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 2CAE43865466 |
Date: | Mon, 23 Jun 2025 21:46:31 +0200 |
To: | cygwin-patches AT cygwin DOT com, cygwin AT cygwin DOT com |
Subject: | Re: symlink_native() bug with case-sensitive file-systems Re: |
[PATCH] symlink_native: allow linking to `..` | |
Message-ID: | <aFmvF9cWsr8UCqQ6@calimero.vinschen.de> |
Mail-Followup-To: | cygwin-patches AT cygwin DOT com, cygwin AT cygwin DOT com |
References: | <6058889e2ae8c9c827a8d6678f09b3b1741e2fcf DOT 1750413578 DOT git DOT johannes DOT schindelin AT gmx DOT de> |
<CAHnbEGLjsy4MZD+oqjGbd=JrX+q8an3mhT38xndEgjmTpWyOnw AT mail DOT gmail DOT com> | |
<aFkPUI22HlYnYhZh AT calimero DOT vinschen DOT de> | |
<CAHnbEG+7T8K50WkDN4=xBA_ir8N3M32=ZGJnYvCFSpH7UquZ=Q AT mail DOT gmail DOT com> | |
MIME-Version: | 1.0 |
In-Reply-To: | <CAHnbEG+7T8K50WkDN4=xBA_ir8N3M32=ZGJnYvCFSpH7UquZ=Q@mail.gmail.com> |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.30 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | cygwin-patches AT cygwin DOT com |
Cc: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
Errors-To: | cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com> |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id 55NJlYL83788151 |
On Jun 23 20:22, Sebastian Feld wrote: > On Mon, Jun 23, 2025 at 10:52 AM Corinna Vinschen > <corinna-cygwin AT cygwin DOT com> wrote: > > > > On Jun 20 13:33, Sebastian Feld wrote: > > > On Fri, Jun 20, 2025 at 12:03 PM Johannes Schindelin > > > <johannes DOT schindelin AT gmx DOT de> 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. > > OK, but this is at least bad for performance. > > Some stats from a profiling tool I am working on: > German language, multibyte locale, codepage 65001: > Each towupper() traverses 11 functions, covering between 8002 and > 11722 instructions, and between 260 and 469 branches, on 64bit. > If the code could just use the per-volume case sensitive flag, then > this could be reduced to 20-30 instructions just to do the indirect > load (2 times) and compare. Yes, but real life is working against you. I would bet that most users never touch case sensitivity settings and most scenarios are touching case insensitive paths. Worse, consider a case-sensitive dir: C:\foo\bar\baz\i_am_a_case_sensitive_dir All path components preceeding the i_am_a_case_sensitive_dir have to be compared case insensitive! *Only* the i_am_a_case_sensitive_dir and path components below that have to be compared case sensitive. No fun. No fun at all. > > > 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. > > Yikes. Does Windows cache this per-dir info somewhere? I honestly don't know. 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |