Skip to content

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

Closed

Description

@vicuna

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.

Activity

  1. vicuna commented on Sep 20, 2012

    @vicuna
    Author

    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.

  2. vicuna commented on Nov 20, 2015

    @vicuna
    Author

    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.

  3. vicuna commented on Apr 19, 2016

    @vicuna
    Author

    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).

  4. vicuna commented on Oct 19, 2017

    @vicuna
    Author

    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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions