You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ocamlrun gets confused on cygwin if the name of the supplied bytecode file clashes with another file in the path #5250
Original bug ID: 5250 Reporter: slindley Assigned to:@xavierleroy Status: resolved (set by @xavierleroy on 2017-10-19T09:51:30Z) Resolution: fixed Priority: normal Severity: minor Version: 3.12.0 Fixed in version: 4.07.0+dev/beta2/rc1/rc2 Category: runtime system and C interface
Bug description
Suppose 'foo' is a bytecode file, and a different file 'foo' is in the path, then we get the following behaviour:
$ ocamlrun foo
Fatal error: the file foo is not a bytecode executable file
whereas:
$ ocamlrun ./foo
works as expected.
If the genuine 'foo' is accessible from PATH, and the bogus 'foo' is a directory that is accessible earlier in PATH, then we get a more informative error message by invoking the genuine 'foo' directly:
$ foo
/path/to/bogus/foo not found or is not a bytecode executable file
The first case also occurs under Mac OS X, although 4.00.0 gives the better error message.
Possible solution: add a "-" command-line flag to ocamlrun that says the rest of the command line is bytecode+arguments, and don't look for the bytecode in the path.
Another possible solution: add a "-path" flag to tell ocamlrun to look for the bytecode in the PATH (and don't do it by default), and use that option in the header of executable bytecode files.
The user's manual documents the fact that "ocamlrun" searches its first argument in the path. Moreover, there is always the "ocamlrun ./foo" workaround. In the absence of new information, I move to close this PR.
For the first issue, the error message is now fully informative.
For the second issue, we should ignore directories while searching in the path, because that's what the shell does (as well as ocaml on non-cygwin systems).
Activity
vicuna commentedon Sep 20, 2012
Comment author: @damiendoligez
The first case also occurs under Mac OS X, although 4.00.0 gives the better error message.
Possible solution: add a "-" command-line flag to ocamlrun that says the rest of the command line is bytecode+arguments, and don't look for the bytecode in the path.
Another possible solution: add a "-path" flag to tell ocamlrun to look for the bytecode in the PATH (and don't do it by default), and use that option in the header of executable bytecode files.
vicuna commentedon Nov 20, 2015
Comment author: @xavierleroy
The user's manual documents the fact that "ocamlrun" searches its first argument in the path. Moreover, there is always the "ocamlrun ./foo" workaround. In the absence of new information, I move to close this PR.
vicuna commentedon Apr 19, 2016
Comment author: @damiendoligez
For the first issue, the error message is now fully informative.
For the second issue, we should ignore directories while searching in the path, because that's what the shell does (as well as ocaml on non-cygwin systems).
vicuna commentedon Oct 19, 2017
Comment author: @xavierleroy
For the second issue, pull request at #1435
Marking as resolved/fixed in 4.07.