delorie.com/archives/browse.cgi | search |
DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 5795g6du4154679 |
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 5795g6du4154679 |
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=yaOKKyX9 | |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 96E4D3857032 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1754718124; | |
bh=cuHGbV/spz/UnIUkDiKJyUeKT+V/51509k8ImLNZe88=; | |
h=Date:To:cc:Subject:In-Reply-To:References:List-Id: | |
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: | |
From:Reply-To:From; | |
b=yaOKKyX9GacXjrYe3JUH1a3X/m+BxyIx0wzDxYJQ57Ke+OC2TZKMAqu0aSVqLLRS+ | |
GcPNgmw58i//HiVXWcnlXDv1KCl7OmvGx83kJntGrLU+5TyZGVPmc2dcAKylt9YIz2 | |
TnERK/9tBlbkxnqjOaaMSdr7AVmplYZOYsMUDypo= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org 53C473858D29 |
ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org 53C473858D29 |
ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1754718063; cv=none; |
b=GVozUATxw6QcU/5IP1GRR2vkycbsVHr0JGkLqGeNyLMeh+eMkEJEnc4PoD0SbrZyj0ZmDCmOMtw78c73swxspM5nu9Lq5HzEb9Fk4mOXru/gDnMjmWaKEeXzzpKVAl3AQa17PQ2Lo40tKQx1impkJO/+coG0RJHTJHsUGofUVhg= | |
ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
t=1754718063; c=relaxed/simple; | |
bh=kq3OTNTcVnLR7F+g8VqNr16ZLvHE1H/3LaUvryoCZks=; | |
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; | |
b=UDKxaXf5yy5jREATqp4k+qMk6ZPLa1Nijt9vDuuc59KlhAwyeKD6f3luG/M+Gg/t0hH6e1plZQXUpzHdR8pbnaPSItyUr05ymtzf+mfD0uVoxwOGvqNhF0zQaPdtDk3v01CzJnl+Tj5hhU6wdku4lNrZgDCve/ka3JhQvq2Oc4g= | |
ARC-Authentication-Results: | i=1; server2.sourceware.org |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 53C473858D29 |
Date: | Fri, 8 Aug 2025 22:33:25 -0700 (PDT) |
X-X-Sender: | jeremyd AT resin DOT csoft DOT net |
To: | Brian Inglis via Cygwin <cygwin AT cygwin DOT com> |
cc: | brian DOT inglis AT systematicsw DOT ab DOT ca |
Subject: | Re: getting the on-disk case for a path |
In-Reply-To: | <585f65a8-a675-4a1e-a774-5dc4ff2337f8@systematicsw.ab.ca> |
Message-ID: | <81c4de12-856c-2d1d-d6bf-ee0fe96f3429@jdrake.com> |
References: | <36a0093c-fc8b-f268-9cbf-71c1c1268ef7 AT jdrake DOT com> |
<11a5bd41-e977-4f25-9bf8-4917f1c65934 AT towo DOT net> | |
<585f65a8-a675-4a1e-a774-5dc4ff2337f8 AT systematicsw DOT ab DOT ca> | |
MIME-Version: | 1.0 |
X-Content-Filtered-By: | Mailman/MimeDel 2.1.30 |
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: | Jeremy Drake via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Jeremy Drake <cygwin AT jdrake 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 5795g6du4154679 |
On Fri, 8 Aug 2025, Brian Inglis via Cygwin wrote: > On 2025-08-08 00:53, Thomas Wolff via Cygwin wrote: > > Am 08.08.2025 um 02:31 schrieb Jeremy Drake via Cygwin: > >> On a case-insensitive but case-preserving filesystem, is there a Cygwin > >> API to get the on-disk case for a given path? It seems like `realpath` > >> ought to do it but running > >> $ touch case-test > >> $ realpath CASE-TEST > >> returns CASE-TEST. > > On the command line, you could use > > ls | grep -i > > > >> Regardless, canonicalize_file_name or realpath may not > >> be what I want because it would dereference symlinks. > >> > >> Background: I'm trying to debug some test failures in Clang, due to a > >> warning that's supposed to be issued when you #include "foo.h" but the > >> file on disk that it opened is "Foo.h". > > Looks like if you use wildcards, it should work correctly: > > $ lsattr -dl . > . --- > $ l *_exit* > _Exit.2 _exit.3 > $ l _exit.? > _Exit.2 _exit.3 > $ l _exit.[23] > _Exit.2 _exit.3 > $ l *EXIT-TEST* > exit-test > $ l *exit* > _Exit.2 _exit.3 EXIT exit-test > > also, you could just opendir(3)/readdir(3)/closedir(3) and strcasecmp(3). > Yeah, globbing is opendir/readdir/closedir, but it'd have to be done on each path component to recover the on-disk case for a path. I'll explain now that I have a better idea what clang is doing under the hood. llvm has an API that opens a file with an out parameter for the "real" path. On Windows, it uses GetFinalPathNameByHandleW (FILE_NAME_NORMALIZED|VOLUME_NAME_DOS), with some massaging for UNC. On Unix, it first would prefer fcntl with F_GETPATH. It doesn't look like Cygwin provides that. If that's not available, available, it tries readlink on /proc/self/fd/%d. If that's not available, it falls back to realpath on the name input. I had a breakpoint on realpath that was not hit, so it appears that readlink is what it's doing. -- 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 |