Skip to content

suggestion (which I can implement, if you agree): reject (or firmly warn against) cygwin-style paths in ocamlfind #105

@chetmurthy

Description

@chetmurthy

(1) OCaml doesn't accept cygwin-style paths, viz. /cygdrive/d/bla/bala/bla.

(2) there's nothing wrong with that: it's a design decision.

(3) but on windows, OCaml uses cygwin in its CI.

(4) this means that it is -easy- to end up using cygwin paths in your configuration and builds.

(5) these paths get silently ignored by OCaml, and you end up with .... confusing and paradoxical build-errors, e.g.

make[1]: Entering directory '/cygdrive/d/a/ci-sandbox/ci-sandbox/cygwin/b'
ocamlc -I /cygdrive/d/a/ci-sandbox/ci-sandbox/cygwin/a foo.cmo bar.ml -o foobar
File "bar.ml", line 1, characters 13-21:
1 | print_string Foo.name
                 ^^^^^^^^
Error: Unbound module "Foo"

(6) And this can show up via ocamlfind too: if a package has a "directory" that is a cygwin path, then when that package gets used, that directory will end up prepended to archives used from that package. Which again will lead to silent errors from ocaml.

It would be a simple thing to check (on Windows) that anywhere in ocamlfind where a path is input (whether in a META file, or on the command-line) that could end up being passed to OCaml that that path is -not- a cygwin path. This would mean that in places like "-destdir", cygwin paths would still be accepted. But not in META files. And (I haven't thought this thru completely) maybe not in other places in cmdline arguments.

If you'd be OK with such a change, I can go figure it out and submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions