Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006498OCamlOCamlbuild (the tool)public2014-07-25 17:362014-09-15 16:13
Reportermaro 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version4.01.0 
Target Version4.02.2+devFixed in Version 
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 b.ml with the following command:

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

I obtain the following error message:

File "b.ml", 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

-  Notes
(0011933)
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" > a.ml
mkdir d1
mkdir d1/d2
touch d1/d2/b.ml
ln -s d2 d1/d3
ocamlbuild -I d1/d2 a.native # works
ocamlbuild -I d1/d3 a.native # unbound module B
(0011948)
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.

- 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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker