Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005996OCamlOCamlbuild (the tool)public2013-04-22 09:462014-09-24 16:55
Assigned To 
PlatformLinuxOSOS Version
Product Version4.00.1 
Target Version4.02.2+devFixed in Version 
Summary0005996: ocamlbuild -build-dir dangerous behaviour
DescriptionI run this command :
ocamlbuild -build-dir ../../toto ..
which did not work
+ mkdir /home/william/tmp/test/test2/..
mkdir: impossible de créer le répertoire « /home/william/tmp/test/test2/.. »: Le fichier existe
Command exited with code 1.
  Error during command "mkdir /home/troit/tmp/test/test2/..": My_std.Exit_with_code(10).

then I did this :
ocamlbuild -build-dir '~/svn/build'
which created the directory '~' in the repository where I executed ocamlbuild

Then I wanted to remove the directory :
rm -Rf ~

Don't explain you what the problem is. Felt like a newbe
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
ygrek (reporter)
2013-07-29 05:12

PEBKAC, ocamlbuild behaviour is correct.
Passing '~' inside single quotes precludes its expansion by the shell, and tells ocamlbuild to use literally the '~' directory, instead of $HOME, exactly what happened.
You probbably want to use "~" (inside double quotes). Read 'man bash' for shell quoting rules before using the shell.
william (reporter)
2013-07-29 08:41
edited on: 2013-07-29 08:45

ah ah.
ok, but let's try to isolate things :

1) make ../foo works,
but ocamlbuild -build-dir ../foo does not work

2) make '~/foo' does not work (and does not create a folder named '~')
but ocamlbuild -build-dir '~/foo' creates directory '~' (becareful, do not launch this command unless you know how to remove '~' without removing your home directory :-), which I don't, so will not try it again)

3) make "~/foo" works (thanks ygrek for the explanation about " and ')
but ocamlbuild build-dir "~/foo" creates directory '~' (and subfolders) inside the directory, as subdirectories without expanding '~'.

and '~' can be removed by doing :
rmdir \~

william (reporter)
2013-07-29 08:47

for information, there is no big deal with all this, there may be more important things. also, it was quite clear in the doc that build dir was to be local.
gasche (developer)
2013-07-29 08:57

There are some difficulties with absolute vs. relative paths in various places in OCamlbuild. This precise issue is at least a case of confusing user interface.

- Issue History
Date Modified Username Field Change
2013-04-22 09:46 william New Issue
2013-04-22 23:12 doligez Severity major => minor
2013-04-22 23:12 doligez Status new => confirmed
2013-04-22 23:12 doligez Target Version => 4.01.0+dev
2013-07-29 05:12 ygrek Note Added: 0009960
2013-07-29 08:41 william Note Added: 0009966
2013-07-29 08:45 william Note Edited: 0009966 View Revisions
2013-07-29 08:47 william Note Added: 0009967
2013-07-29 08:57 gasche Note Added: 0009969
2013-08-19 16:25 doligez Target Version 4.01.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-24 23:07 doligez Target Version 4.02.0+dev => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-24 16:55 doligez Target Version undecided => 4.02.2+dev

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker