<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<span id="OLK_SRC_BODY_SECTION">
<div>
<div>On 4/11/16, 4:12 PM, "Jason Haslam" <<a href="mailto:jason.haslam@gmail.com">jason.haslam@gmail.com</a>> wrote:</div>
</div>
<div><br>
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div>
<blockquote type="cite" class="">
<div class="">On Apr 7, 2016, at 5:44 PM, Eric Niebler via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;" class="">
<span id="OLK_SRC_BODY_SECTION" class="">
<div class="">
<div class="">On 4/7/16, 11:37 AM, "<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a> on behalf of Chris Lattner" <<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>> wrote:</div>
</div>
<div class=""><br class="">
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;" class="">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Apr 5, 2016, at 4:03 PM, Eric Niebler via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;" class="">
<div class="">
<div class="">
<div class="">Hi all,</div>
<div class=""><br class="">
</div>
<div class="">I have an initial cut at patch that issues a warning when a file is #included on a case-insensitive file system that would not be found on a case-sensitive system. Is there interest?</div>
<div class=""><br class="">
</div>
<div class="">Since this is a hard problem to solve perfectly, I have opted for a strategy that is efficient and conservative about issuing diagnostics. That is, it shouldn't give false positives, but it will fail to diagnose some non-portable paths. On *nix
 systems, the low-level APIs that stat and open files get an extra call to ::realpath, and the result is cached along with the rest of the file metadata. […]</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</span></div>
</div>
</blockquote>
</div>
<br class="">
<div class="">I was working on a similar patch a few years ago (<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_pipermail_cfe-2Ddev_2012-2DJuly_023090.html&d=CwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=t4UJXwtMcIwGvgOaMqGzrQ&m=c8D9-z1QyfRWobwgBlnojB0yAu4P3Ve2-Wk9Z4vAxjg&s=5yrhYcvssUCiHzENOa2jFtUbhJNW1jTrGLKAnlJLkuQ&e=" class="">http://lists.llvm.org/pipermail/cfe-dev/2012-July/023090.html</a> is
 the start of a very long thread). Does realpath really give the real case on unix? My understanding is that it doesn’t. I had to resort to reading the directory listings and comparing entries. And of course readdir is even slower. I could only ever get decent
 performance by aggressively caching the directory listings. In the end it got too complicated and wasn’t entirely convinced that performance would ever be good enough to warrant the addition. I was mostly interested in Mac though. Maybe it’s a different story
 on Windows.</div>
<div class=""><br>
</div>
</div>
</div>
</blockquote>
</span>
<div><br>
</div>
<div><br>
</div>
<div>I haven't been able to successfully mount a case-insensitive file system on my Linux VM, so I haven't specifically tested this. On Mac, realpath gets the case right, but it's not needed since it has fcntl/F_GETPATH, which I've discovered is faster. In
 my tests, realpath does <span style="font-weight: bold;">not</span> get the right case on Cygwin. On *nixes that have /proc, it's possible to readlink on /proc/self/fd/$FD once the file is opened, and that
<i>should</i> give the properly cased filename. I haven't done extensive benchmarking, but that is certain to be faster than recursive directory traversal. But not all *nixes have /proc.</div>
<div><br>
</div>
<div>TL;DR this is going to be an unreliable warning. Personally, I think that's fine so long as it doesn't give false positives and doesn't slow things down too badly. I'm busy reworking the patch to that end.</div>
<div><br>
</div>
<div>\e</div>
<div><br>
</div>
<div>
<div>
<div><br>
</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
</div>
</body>
</html>