-
Notifications
You must be signed in to change notification settings - Fork 412
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
Normalize case of context root under Win32 #3966
Conversation
One thing I didn't understand from the slack conversation is if its the drive letter that is case insensitive or the entire path? This change is only right if it's the latter. |
I think it can be the whole path. I am trying to come up with a reproduction case. |
It's true for the entire path, but I don't think you want to do this routinely - it can break if you happen to be on a case sensitive file system which is mounted and it looks suspicious when you start seeing Actually get the correct path involves a fairly simply wrapping of |
But I think that changing
This sounds simple enough. Do I understand your suggestions correctly to mean that we should call |
Yeah, I realised that was likely to be the case... but equally the lowercase trick might just defer the problem to another day 🙂
Yes I believe that it will do the conversion - although |
@dra27 Coming back to this, the |
I'm not sure - I'd expect that it would normalize it to uppercase, to be honest. It'd obviously be quite safe to do that in Dune to be sure. Some prior art (from a brief look around - the pull requests are old):
(links as |
The problem I have is that It'd obviously be quite safe to do that in Dune to be sure. Some prior art (from a brief look around - the pull requests are old):
Looks like it calls
This one uses |
Coming back to this as this issue is blocking for us as it causes a lot of needless recompilation. I pushed a simpler fix which just normalizes the context root to lowercase under Windows. This fixes the recompilation problem for us. Would appreciate a review! cc @dra27 @rgrinberg |
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.
Looks good to me. There are other uses of Sys.getcwd ()
in the codebase, but if this fix is enough then so be it.
This needs a CHANGES entry as well.
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
Done. I also cleaned the patch up a bit by adding |
I believe @dra27 it busy these days, so unless someone objects, I am planning to merge this as it is in the next few hours since it solves an actual problem and the change is small. |
We discussed the PR with @dra27 on Slack, and he didn't see anything blocking (even if maybe the patch can be improved later on), so I will merge as soon as the CI is green. |
I was looking at how to make cram tests work better on windows and I was surprised to see that now the result of
|
Uf for once I thought this was going to be painless, but I was wrong... |
Just to make sure I understand: is |
Yes, the cygwin root is |
To be clear, the problem you have is with one path (namely, the context root) when passed to |
I first tried to change cram rules so that both the POSIX and Windows versions of cwd are replaced by dune/src/dune_rules/cram_exec.ml Line 150 in 8330833
In turn, this function uses Lines 588 to 593 in 8330833
Because of this, the value that's being replaced as |
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
…ne-action-plugin, dune-private-libs and dune-glob (2.8.3) CHANGES: - Make `patdiff` show refined diffs (ocaml/dune#4257, fixes ocaml/dune#4254, @hakuch) - Fixed a bug that could result in needless recompilation under Windows due to case differences in the result of `Sys.getcwd` (observed under `emacs`). (ocaml/dune#3966, @nojb). - Restore compatibility with Coq < 8.10 for coq-lang < 0.3 , document that `(using coq 0.3)` does require Coq 8.10 at least (ocaml/dune#4224, fixes ocaml/dune#4142, @ejgallego) - Add a META rule for 'compiler-libs.native-toplevel' (ocaml/dune#4175, @AltGr) - No longer call `chmod` on symbolic links (fixes ocaml/dune#4195, @dannywillems) - Dune no longer automatically create or edit `dune-project` files (ocaml/dune#4239, fixes ocaml/dune#4108, @jeremiedimino) - Have `dune` communicate the location of the standard library directory to `merlin` (ocaml/dune#4211, fixes ocaml/dune#4188, @nojb) - Workaround incorrect exception raised by Unix.utimes (OCaml PR#8857) in Path.touch on Windows (ocaml/dune#4223, @dra27) - `dune ocaml-merlin` is now able to provide configuration for source files in the `_build` directory. (ocaml/dune#4274, @voodoos) - Automatically delete left-over Merlin files when rebuilding for the first time a project previously built with Dune `<= 2.7`. (ocaml/dune#4261, @voodoos, @aalekseyev) - Fix `ppx.exe` being compiled for the wrong target when cross-compiling (ocaml/dune#3751, fixes ocaml/dune#3698, @toots) - `dune top` correctly escapes the generated toplevel directives, and make it easier for `dune top` to locate C stubs associated to concerned libraries. (ocaml/dune#4242, fixes ocaml/dune#4231, @nojb) - Do not pass include directories containing native objects when compiling bytecode (ocaml/dune#4200, @nojb)
As discussed on Slack, the case of
Sys.getcwd
can vary from invocation to invocation ofdune
depending on the environment. This can result in gratuitous recompilations.To avoid this, this PR proposes to normalize the case of
Sys.getcwd
(as exposed byPath
) to lowercase (under Windows only).cc @dra27 @rgrinberg