Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006498OCaml-for ocamlbuild use 17:362015-03-27 22:33
Assigned To 
PlatformOSOS Version
Product Version4.01.0 
Target Version4.02.2+dev / +rc1Fixed in Version4.02.2+dev / +rc1 
Summary0006498: Some relative symlinks seem not to be followed
DescriptionRelative symbolic links for directories with "../../" in their paths do not seem to be correctly followed.

I had the issue arrive in a large project, and I tried to reproduce it in a smaller directory structure (attached).

In the folder containing the extracted paths, when trying to compile with the following command:

ocamlbuild -I dir1/dir2 -I dir1/dir4/dir3 b.native

I obtain the following error message:

File "", line 2, characters 0-6:
Error: Unbound module C
Command exited with code 2.

I expected module C to be found since it is present in directory dir3.

If I run instead this command:

ocamlbuild -I dir1/dir2 -I dir1/dir4/dir5 b.native

Then compilation succeeds, as expected.

The difference between them, if I'm not mistaken, is that dir3 is a symbolic link to a *directory* which contains "../../" (two occurrences of "..") in its path, while dir5 is a standard directory containing a symbolic link to a file. Though this symbolic link also contains "../../" in its path, it still works.

Note that a single "../" is not an issue, as exemplified by the dir2 directory. Symlinks to directories containing 3 or more ".." also seem to trigger the issue.
Steps To ReproduceUncompress the contents of the attached tar.gz file and run:

ocamlbuild -I dir1/dir2 -I dir1/dir4/dir3 b.native

ocamlbuild -I dir1/dir2 -I dir1/dir4/dir5 b.native

The first line should succeed but fails, while the second one succeeds.
TagsNo tags attached.
Attached Filesgz file icon dirs.tar.gz [^] (368 bytes) 2014-07-25 17:36

- Relationships
related to 0005395closedxclerc OCamlbuild ignores relative-symlinked subdirectories or subdirectories with a trailing slash. 

-  Notes
maro (reporter)
2014-07-28 15:43

I did some more tests, and the "../.." does not seem to be the problem (it does work in some cases), but the issue seems related to:

1) using an include with nested directories (e.g. -I dir1/dir2);
2) using a relative symbolic link for a directory.

I still couldn't find the exact situations where these work and where they don't, but it seems I have to combine both to obtain an error.

It would seem that in some cases the relative path is interpreted with respect to the directory from where ocamlbuild is run, instead of the directory containing the relative symbolic link. For instance, the following example code seems to trigger the issue on my machine:

echo "open B" >
mkdir d1
mkdir d1/d2
touch d1/d2/
ln -s d2 d1/d3
ocamlbuild -I d1/d2 a.native # works
ocamlbuild -I d1/d3 a.native # unbound module B
doligez (administrator)
2014-07-30 22:45

The problem seems to be that ocamlbuild reproduces the structure of the source directory under _build, but fails to reproduce the symlinks.
doligez (administrator)
2015-03-27 22:33

This is fixed by the fix for 0005395 (branch 4.02, rev 15970).

- Issue History
Date Modified Username Field Change
2014-07-25 17:36 maro New Issue
2014-07-25 17:36 maro File Added: dirs.tar.gz
2014-07-28 15:43 maro Note Added: 0011933
2014-07-30 22:45 doligez Note Added: 0011948
2014-07-30 22:46 doligez Status new => confirmed
2014-07-30 22:46 doligez Target Version => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-15 16:13 doligez Target Version undecided => 4.02.2+dev / +rc1
2015-02-26 16:59 doligez Relationship added related to 0005395
2015-03-27 22:33 doligez Note Added: 0013584
2015-03-27 22:33 doligez Status confirmed => closed
2015-03-27 22:33 doligez Resolution open => fixed
2015-03-27 22:33 doligez Fixed in Version => 4.02.2+dev / +rc1
2017-02-23 16:34 doligez Category OCamlbuild (the tool) => for ocamlbuild use [^]
2017-02-23 16:44 doligez Category for ocamlbuild use [^] => -for ocamlbuild use [^]

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker