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

ocamlrun gets confused on cygwin if the name of the supplied bytecode file clashes with another file in the path #5250

Closed
vicuna opened this issue Apr 7, 2011 · 4 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Apr 7, 2011

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

Again:

$ ./foo

works as expected.

@vicuna
Copy link
Author

vicuna commented 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
Copy link
Author

vicuna commented 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
Copy link
Author

vicuna commented 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
Copy link
Author

vicuna commented Oct 19, 2017

Comment author: @xavierleroy

For the second issue, pull request at #1435

Marking as resolved/fixed in 4.07.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants