You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4502 Reporter: Bardou Assigned to:@gasche Status: closed (set by @xavierleroy on 2015-12-11T18:19:50Z) Resolution: fixed Priority: normal Severity: minor Version: 3.11+dev Target version: 4.01.0+dev Category: ~DO NOT USE (was: OCaml general) Duplicate of:#5503
Bug description
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:
~/caml/test> ls
a _tags
~/caml/test> ls a
test.ml
~/caml/test> cat _tags
: include
~/caml/test> cat a/test.ml
print_int 1; print_newline ();;
~/caml/test> ocamlbuild -build-dir bli test.byte
Finished, 3 targets (0 cached) in 00:00:00.
~/caml/test> ocamlbuild -build-dir bla test.byte
SANITIZE: a total of 3 files that should probably not be in your source tree
has been found. A script shell file "bla/sanitize.sh" is being created.
Check this script and run it to remove unwanted files or use other options
(such as defining hygiene exceptions or using the -no-hygiene option).
IMPORTANT: I cannot work with leftover compiled files.
ERROR: Leftover dependency files:
File test.ml.depends in bli/a has suffix .ml.depends
ERROR: Leftover Ocaml compilation files:
File test.cmo in bli/a has suffix .cmo
File test.cmi in bli/a has suffix .cmi
Exiting due to hygiene violations.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.
The text was updated successfully, but these errors were encountered:
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:
ocamlbuild hello.byte -build-dir titi # succeeds
ocamlbuild hello.byte -build-dir toto # hygiene problem with 'titi'
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".
Original bug ID: 4502
Reporter: Bardou
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:19:50Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11+dev
Target version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #5503
Bug description
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:
~/caml/test> ls
a _tags
~/caml/test> ls a
test.ml
~/caml/test> cat _tags
: include
~/caml/test> cat a/test.ml
print_int 1; print_newline ();;
~/caml/test> ocamlbuild -build-dir bli test.byte
Finished, 3 targets (0 cached) in 00:00:00.
~/caml/test> ocamlbuild -build-dir bla test.byte
SANITIZE: a total of 3 files that should probably not be in your source tree
has been found. A script shell file "bla/sanitize.sh" is being created.
Check this script and run it to remove unwanted files or use other options
(such as defining hygiene exceptions or using the -no-hygiene option).
IMPORTANT: I cannot work with leftover compiled files.
ERROR: Leftover dependency files:
File test.ml.depends in bli/a has suffix .ml.depends
ERROR: Leftover Ocaml compilation files:
File test.cmo in bli/a has suffix .cmo
File test.cmi in bli/a has suffix .cmi
Exiting due to hygiene violations.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.
The text was updated successfully, but these errors were encountered: