-
Notifications
You must be signed in to change notification settings - Fork 413
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
fix: correctly handle absolute paths in dune ocaml top-module #8249
fix: correctly handle absolute paths in dune ocaml top-module #8249
Conversation
Alizter
commented
Jul 23, 2023
•
edited
Loading
edited
- fix dune ocaml top-module crashes when given an absolute path #7370
5811fed
to
3411cef
Compare
Instead of disallowing them, you could just strip the initial PWD and look for corresponding source file |
@rgrinberg What if the prefix isn't shared? I'll have to add some logic making sure its a prefix etc. |
If the prefix isn't shared, then the path is outside the workspace and there's very little we can do for the user. |
Also I'm not sure the initial PWD is the correct thing to choose. You can imagine a project |
Okay sure, you can use the workspace root. |
3411cef
to
6cb50b8
Compare
@rgrinberg I've implemented the prefix handling logic. There is some refactoring we should do in the future: |
6cb50b8
to
96769ee
Compare
bin/ocaml/top.ml
Outdated
Path.Local.of_string module_path | ||
else | ||
let root = | ||
(Common.root common).dir |> Path.of_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you just use Path.root
here?
Signed-off-by: Ali Caglayan <alizter@gmail.com>
I ran into this annoying issue and took the liberty to revive this PR. |
96769ee
to
a8b63f7
Compare
…8249) Signed-off-by: Ali Caglayan <alizter@gmail.com>
CHANGES: - Fix performance regression for incremental builds (ocaml/dune#9769, fixes ocaml/dune#9738, @rgrinberg) - Fix `dune ocaml top-module` to correctly handle absolute paths. (ocaml/dune#8249, fixes ocaml/dune#7370, @Alizter) - subst: ignore broken symlinks when looking at source files (ocaml/dune#9810, fixes ocaml/dune#9593, @emillon) - subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (ocaml/dune#9811, fixes ocaml/dune#9538, @emillon) - boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (ocaml/dune#9861, fixes ocaml/dune#9794, @emillon)
CHANGES: - Fix performance regression for incremental builds (ocaml/dune#9769, fixes ocaml/dune#9738, @rgrinberg) - Fix `dune ocaml top-module` to correctly handle absolute paths. (ocaml/dune#8249, fixes ocaml/dune#7370, @Alizter) - subst: ignore broken symlinks when looking at source files (ocaml/dune#9810, fixes ocaml/dune#9593, @emillon) - subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (ocaml/dune#9811, fixes ocaml/dune#9538, @emillon) - boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (ocaml/dune#9861, fixes ocaml/dune#9794, @emillon)