Ocamlbuild finds erroneous sanitization errors when using the -build-dir option #4502
Original bug ID: 4502
I use ocamlbuild with the -build-dir option. In my project, to get the bug, I compile once, using ocamlbuild with option "-build-dir bin", from a clean directory and everything's fine. Then I compile using the same command and the hygiene test finds not hygienous files in the "bin" directory. Which is absolutely normal, because it is the build directory. The "bin" directory is not included using -I or anything.
Using -no-hygiene allows to compile correctly, and cached files are used correctly.
I was unable to reproduce exactly the same bug in a small example. However, I did manage to get something very similar by changing the -build-dir directory between the two commands. I found that the _tags file is needed for the bug to happen. Here is how to reproduce the bug:
The text was updated successfully, but these errors were encountered:
Comment author: @gasche
There was a problem with the test excluding the build directory from hygiene checking. Funnily enough, this problem was introduced when fixing #5503, that is after the initial report here.
I'm not exactly sure which problem Romain originally run into, but I fixed the build_dir issue (and added a regression test for this in Wojciech's wonderful testsuite).
Note that ocamlbuild has "true: traverse" enabled (which happens when you have either a _tags or a myocamlbuild.ml in the directory), the following will still fail in general:
The reason for the failure is that the first command creates a new directory 'titi', which will not be excluded from the second run (it is not the build directory anymore), and will therefore be checked for hygiene. If you do that, you need to tag with "-traverse".