"Version" include wreaks havoc on case-insensitive filesystems
bugs.llvm.org
bugs.llvm.org
There is a (not so) modern (any more) gcc option -iquote to specify a directory to search for #include "..." without affecting #include <...>.
In the TXR project I have a "signal.h" local file:
http://www.kylheku.com/cgit/txr/tree/signal.h
Yet, <signal.h> is also included. Like in this file:
http://www.kylheku.com/cgit/txr/tree/signal.c
which has both #include <signal.h> and #include "signal.h".
This is fine, if you know what you're doing. #include <signal.h> has no business finding that local file, and will not do so, unless someone screws up.
See https://www.gnu.org/software/autoconf/manual/autoconf-2.69/h... for more info.
That said, there is no requirement at all that "#include <version>" must pick up a file called "version" (of any case). The compiler could prefer a file called "version.standard-header", if it exists, or "std/version"; or, things in <> brackets could be looked up on a different list, such as one designated by "--isystem" (which does already exist). There doesn't need to be such a file at all -- the standard just says what names must be found to be defined after that point in the code. The compiler can Just Know. Or, it can recognize just Standard header names, and get them somewhere special. Which is why we don't bother about this in committee. Doing the dumb thing is dumb, no matter what we say. Do the smart thing, and trouble evaporates.
I always thought it was mad that compilers shipped with standard header files that had exactly the name as appears in the standard, and that preprocessors shipped that favor or require such. If you need for the files to have exactly those names, define a cpp option naming a file with a list of them, and exactly where each is.
So while it makes sense that system headers needn't be files - in principle - it sounds like a pretty big change too with some downsides as well. All that just for "version"?
It really is on the compiler implementers for not providing a better accommodation to this very predictable problem.
That said, fixing the autoconf scripts may be the most immediate route to sanity for the "config.h" / <version> case, eliminating the problem at its source.
In other words, there's no reason why '#include <foo>' should ever be looking in the translation unit's directory; that's what '#include "foo"' is for.
What's mad is that -I controls where <> names are searched.
-I is a traditional option from Unix compilers with a very silly behavior; but for years now we have had something called -iquote in gcc (and clang).
Before -iquote, there was -I- which is deprecated.
Documented, public <> headers include other headers that are not documented. There is no telling what their names are.
Hoping that compilers would not resolve headers via user-specifiable directories sounds absurd to me - every single compiler I know of allows that, not just on unix, so if you want to retire that, that's going to be huge, multi-year effort. No point in considering that hypothetical reality when it comes to meaningful header names unless there is a reasonable likelihood of that happening. Not objecting to such a push; it just sounds wildly out of scope when picking a header file name.
Actually, I kinda like not having the possibility of having both "Downloads" and "downloads" by mistake in my home folder.
Case insensitive filesystems made more sense decades ago than they do today. Case insensitivity is fundamentally a UX feature that has been implemented in the wrong layer. Rather than the filesystem itself being case insensitive, the search functionality in GUI interfaces to the filesystem should be case insensitive. And furthermore, the user should never be typing out the complete name of any file that already exists, because everything should provide auto-completions of existing filenames.
For one somewhat recent example: CVE-2014-9390 git: arbitrary command execution vulnerability on case-insensitive file systems. (Also affected mercurial IIRC.)
Once, a colleague working on Linux created two files with same name but different case, and committed them to the Git repo, and then I tried pulling it on my Mac. I don't remember exactly what happened next, but I wasted a lot of time trying to sort that mess out.
(There was no real reason for them doing this, it was just a mistake on their part, and they didn't notice they'd done it before committing the files.)
It seems to me that most problems with case insensitive file systems are rather problems because there are different file systems out there. Just as there always is with "competing" standards.
Let me put it briefly. Much Linux software is multi platform and vice versa; this is how being the "underdog" (quotes cause servers) works. When you look at the transitive closure of the dependency graph, all sorts of case-insensative assumptions will pop up.
I'm on a shop where all developers run Linux on their laptops, but we work on tools and libraries that are supposed to run on macOS for all those other developers. Supporting them is a huge pain.
I like it when apple iOS-ifies macOS making development harder. Hopefully it brings people out of denial.
Unicode allows different forms that lead to the same representation for the user.
Gödel.txt may be written as - G-\u00F6-del.txt where \u00F6 is "Latin Small Letter O with Diaeresis" or - G-o\0308-del.txt where \u0308 is "Combining Diaeresis"
From user perspective they are indistinguishable.
Traditional Linux filesystems do not normalize this in any way. MacOS filesystems normalize it to decomposed form with "Combining Diaeresis" (which is mad). NTFS does not normalize, but windows apis behave differently - if you create NFC+NFD Gödel.txts under same directory then you will either see both, see one, or even see both, but be able to select only first from system "open file" selector.
I too hate windows because of it's case-insensitivity but that's not the problem here. The problem is a messed up Include-Path and/or the shitty naming/placing of C/++-standard-headers.
It’s amusing and frustrating that you use a lowercase W here, expect everyone to know what you mean, while arguing in favour of case-sensitive filenames - the user-hostile systems which would stubbornly refuse to know what you mean.
What I've never seen is an easy way to convert a case insensitive file system into a valid one after the fact. It would be great to give people an easy way to fix it after the fact.
https://www.quora.com/Why-does-OS-X-choose-to-have-a-case-in...
Perhaps Mac users should just apply a patch and let everyone else use case as a differentiation.
("If you can't say something nice ...")
Even Microsoft is abandoning it as a place to keep source code. At least, their own source code. Windos is not built from a tree on NTFS because it's too slow.
Before that, I knew people who did it with zip drives. And I even once knew a guy who tried it with DVD-RAM, but gave up pretty quick.