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

Incorrect interpretation of relative paths in FLG -ppx #699

Open
jberdine opened this issue Aug 14, 2017 · 6 comments
Open

Incorrect interpretation of relative paths in FLG -ppx #699

jberdine opened this issue Aug 14, 2017 · 6 comments

Comments

@jberdine
Copy link

jberdine commented Aug 14, 2017

I am having trouble with merlin not being able to run ppxs built and configured with jbuilder. The jbuilder compilation works correctly.

jbuilder creates a ppx.exe under _build and adds a line such as the following to .merlin:

    FLG -ppx "_build/default/.ppx/ppx_mine/ppx.exe --as-ppx"

This seems fine, but looking at the merlin-log in emacs, I see:

    # 0.06 Mconfig - normalize
    {
      "ocaml": {
    ...
        "ppx": [ "/_build/default/.ppx/ppx_mine/ppx.exe --as-ppx" ],
    ...
      "merlin": {
        "flags_applied": [
          {
            "cwd": "/",
            "flags": [
              "-ppx",
              "./_build/default/.ppx/ppx_mine/ppx.exe --as-ppx"
            ]
          },
    ...
    }
    # 0.06 Mppx - changing_directory
    /Users/jjb/project/src
    # 0.07 Mppx - rewrite
    failed with Error while running external preprocessor
    Command line: /_build/default/.ppx/ppx_mine/ppx.exe --as-ppx '/var/folders/qd/00gsz33d7zj71k_dhp7bwv5cxm01z7/T/camlppxca635d' '/var/folders/qd/00gsz33d7zj71k_dhp7bwv5cxm01z7/T/camlppx5f4ce4' 1>/dev/null 2>/dev/null

Note the leading / on Command line:

If I edit .merlin to provide the absolute path in FLG -ppx, then everything works as expected.

Should relative paths in a .merlin file be interpreted relative to the directory containing the .merlin file, or something else? Is there an issue where the config is normalized before changing directory?

FWIW, I have merlin and ocaml-migrate-parsetree pinned to master, with a 4.05.0 switch.

@jberdine
Copy link
Author

I don't know if it addressed the root cause, but after ocaml/dune#201, the .merlin files generated by jbuilder include absolute paths and no longer trigger this issue.

@alfa07
Copy link

alfa07 commented Nov 2, 2017

It is still an issue as in our infra as we can't commit files with absolute paths into repo (e.g. it usually includes user's name)

@rgrinberg
Copy link
Member

How come there's a need to commit .merlin files at all? Can't every user generate them with jbuilder?

@jvillard
Copy link

jvillard commented Nov 3, 2017

Can't every user generate them with jbuilder?

Just as a data point, this is not always possible at the moment. For instance infer's .merlin is manually curated from the one generated by jbuilder, mostly because of ocaml/dune#230.

@alfa07
Copy link

alfa07 commented Nov 7, 2017

@jvillard we don't use jbuilder internally, we use buck which doesn't generate .merlin files

@let-def
Copy link
Contributor

let-def commented Oct 18, 2018

The ppx-cwd branch address this issue, #870

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

No branches or pull requests

5 participants