Fix ocamldep-postproc in case-insensitive, case-preserving filesystems. #150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On case-insensitive, case-preserving filesystems,
omakefinds invalid dependencies corresponding to paths that do not exist on disk since they have the wrong capitalization.In particular, given module
Athat depends onB, and the corresponding source filesa.mlandb.ml, if you have a target likeOCamlPackage(runtime, a b),omakewill invokeocamlcas inocamlc -pack -o runtime.cmo B.cmo a.cmo. Now, on a case-insensitive, case-preserving filesystem,b.cmocan be open(2)ed under bothb.cmoandB.cmopaths, butocamlcfails -- it must be doingreaddirand seesB.cmois missing.This is caused by a bug in the
ocamldep-postprocbuiltin. I verified this by overriding its definition in an affected codebase (extprot) under macOS to useOCamlScannerPostproc, which did work.This PR fixes the builtin itself.
Credits
The work on this PR was performed on behalf of Ahrefs open-source work day:
https://twitter.com/javierwchavarri/status/1466774912148910088