Weirdest thing I've seen recently: omc, the OpenModelica compiler, tries to open all its input files (including libraries) for writing. It then closes them, reopens for reading, and proceeds as one'd expect.
It turns out that it does that to determine whether they're read-only: https://github.com/OpenModelica/OpenModelica/blob/81537a472c9f54ea14ecf335343005f18f4e83af/OMCompiler/Compiler/runtime/systemimpl.c#L366
Why? Well, it puts that information in some parser data structure: https://github.com/OpenModelica/OpenModelica/blob/cb76b3bfcad9782ea93ef88aa0979e00ad9ca942/OMCompiler/Parser/parse.c#L420
Why? Well, it uses that when printing an error message, so that the error message can say whether the file is writeable: https://github.com/OpenModelica/OpenModelica/blob/187041202b77c6b2c406f27d1e7add6db6016548/OMCompiler/Compiler/runtime/ErrorMessage.cpp#L136
Why? I have no clue.
How do I know? It messes with gittup's determination of what's an output of a compilation command.