Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamlbuild fails with Sys_error if there is a _tags file anywhere inside an ignored (unhygienic) directory #6482

vicuna opened this issue Jul 10, 2014 · 2 comments


Copy link

@vicuna vicuna commented Jul 10, 2014

Original bug ID: 6482
Reporter: gfxmonk
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:28:11Z)
Resolution: fixed
Priority: normal
Severity: minor
OS: Fedora
OS Version: 20
Version: 4.00.1
Target version: 4.02.1+dev
Fixed in version: 4.02.0+beta1 / +rc1
Category: -for ocamlbuild use
Monitored by: @gasche

Bug description

I could be misreading the cause, this is just what it seems like to me.

Steps to reproduce

  1. Untar the attached minimal workspace
  2. cd into ocamlbuild-bug
  3. ocamlbuild main.native

I get:

Exception Sys_error("deps/foo/_tags: No such file or directory").
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.

Additional information

The attached tar has the basic structure:

  • _tags
  • deps/foo/_tags (empty)
  • deps/main.cmx (empty)

"deps" in the original source tree (which uncovered the bug) is where I've compiled some third party code, so I need it to be ignored by the sanitization plugin. So I've got the following toplevel _tags rule:

: not_hygienic

Running with -no-sanitize still causes the same error, so I don't think it's actually a bug in the sanitize plugin.

File attachments

Copy link

@vicuna vicuna commented Jul 14, 2014

Comment author: @gasche

There is both a bug in ocamlbuild and, I think an incomprehension about what not_hygienic means.

The bug is fixed in 4.02 and trunk.

The incomprehension is the following: gfxmonk seems to expect that not_hygienic means that those directories will not be traversed by ocamlbuild. This is not the case! Non-hygienic directories are normal build directories (which will be used to look for targets to build and their dependencies), only they're allowed to contain stuff that looks like partial build output. In particular, any _tags file contained in those directories will be parsed -- this is why adding not_hygienic was not a workaround for the bug.

If you want to prevent ocamlbuild from traversing a directory, parsing its _tags file and using its content, you should disable the "traverse" tag for this directory:

: -traverse

You can also whitelist directories to traverse by disabling traversal by default:

true: -traverse
: traverse
: traverse

Copy link

@vicuna vicuna commented Jul 14, 2014

Comment author: gfxmonk

Thanks for the fix gasche, and also for the correction - I was indeed confused about what not_hygenic should be used for.

@vicuna vicuna closed this Dec 11, 2015
@vicuna vicuna added this to the 4.02.1 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants