Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004502OCamlOCaml generalpublic2008-02-12 13:372013-06-17 15:22
ReporterBardou 
Assigned Togasche 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.11+dev 
Target Version4.01.0+devFixed in Version 
Summary0004502: Ocamlbuild finds erroneous sanitization errors when using the -build-dir option
DescriptionI 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
<a>: 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.
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0005503resolvedxclerc fatal error with absolute -build-dir 

-  Notes
(0009534)
gasche (developer)
2013-06-17 15:21

There was a problem with the test excluding the build directory from hygiene checking. Funnily enough, this problem was introduced when fixing PR#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 <titi> with "-traverse".

- Issue History
Date Modified Username Field Change
2008-02-12 13:37 Bardou New Issue
2008-02-19 14:45 doligez Status new => acknowledged
2011-09-08 15:17 xclerc Status acknowledged => assigned
2011-09-08 15:17 xclerc Assigned To => xclerc
2012-07-11 15:53 doligez Target Version => 4.01.0+dev
2012-07-31 13:37 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-15 12:03 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-06-17 15:21 gasche Note Added: 0009534
2013-06-17 15:21 gasche Status assigned => resolved
2013-06-17 15:21 gasche Resolution open => fixed
2013-06-17 15:21 gasche Assigned To xclerc => gasche
2013-06-17 15:22 gasche Relationship added duplicate of 0005503


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker