-
Notifications
You must be signed in to change notification settings - Fork 414
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
Rewrite install root based paths #7741
base: main
Are you sure you want to change the base?
Conversation
I promoted more tests, squashed, and rebased. |
0561a76
to
b04df9e
Compare
I'm trying to get a local reproduction of the failing windows tests. I think I found what should be the formula for setting up to test dune on Windows 10. In a checked-out dune repository, I'm doing these commands in powershell: First to setup ocaml on my PC (actually a virtual machine running on my Linux box):
The above appears to run successfully. When the above has run it recommends doing the following to continue, which I did:
It then also recommends doing the following which I did:
The above runs OK until it gets to the "Build boot dune.exe" step which fails like this:
Any suggestions? |
Once you have diskuv installed, what you need to do is run the bootstrap command with
and then
should work as normal for building the dune repo. |
Here is what I get:
I had first used the following link to install diskuv:
Here is the
But I was having problems with that so decided to replicate the CI exactly by using
although the CI itself uses
but I was hoping they would be equivalent. I'm wondering if there is something installed on the CI Windows images but not on my machine that is causing this error. |
You mentioned you were doing this in powershell. I wonder if just doing it in cmd will be different? When I setup windows a few weeks ago, I couldn't get it to work in powershell but it did work in cmd. |
I was using powershell, but the failure I showed above was with cmd. Do you using the link I mentioned to install diskuv, or do you try to replicate what the CI is doing? |
@richardlford I believe I installed diskuv using the installer you linked. Creating the correct environement however required the Edit: Yes, trying it again myself, I needed to use |
In MSVC I am seeing:
That makes me think that your bppm code is separating on |
I'm pretty sure you are correct that a path with "D:" is the source of the problem. But the way things are supposed to work is that Build_path_prefix_map.map's are constructed abstractly, and then when they are encoded any paths in the map are encoded such that ":" and "=" get encoded in a way that they no longer have ":" or "=". That lets ":" and "=" be used as the delimiters, regardless of whether you are on Windows or not. What I think is that there are places that are not doing it that way. In particular, I know that there are test scripts that are setting the BUILD_PATH_PREFIX_MAP directly in ways that would break on Windows. But this failing test is not one of those. To make those other tests more robust we need a way in scripts to do the appropriate encoding. If the CRAM scripts are either running on a *nix system, or on MSYS, then it shouldn't be too hard to make a sed script that will do the appropriate encoding. But, as I said, this test does not do that. In particular, for the windows-diff2.t test that I'm using to diagnose the problem, I've even turned off mapping but the problem is still persisting. Currently, I'm thinking that the Cram sanitizing might be the problem so I'm looking at that code. |
Yes, cram tests will understand and attempt to sanitize using bppm. |
1 similar comment
Yes, cram tests will understand and attempt to sanitize using bppm. |
98bdb47
to
e269618
Compare
@@ -2,7 +2,9 @@ Document how Dune displays various things | |||
========================================= | |||
|
|||
$ echo '(lang dune 3.0)' > dune-project | |||
$ export BUILD_PATH_PREFIX_MAP=SH=`command -v sh` | |||
$ |
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.
empty
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.
Not sure what you mean, but here is the latest code:
$ ENCODED_SH=$(dune_cmd encode-prefix "`command -v sh`")
$ export BUILD_PATH_PREFIX_MAP="SH=$ENCODED_SH"
I've gone through all the places that set BUILD_PATH_PREFIX_MAP manually, and made sure that all of the paths are properly encoded using the new "dune_cmd encode-prefix" command.
When I run command -v sh
on either Linux or MSYS2's bash, I get /usr/bin/sh
. But perhaps on some Windows environments this could give a Windows-like path that would need encoding.
I've pushed to reflect your latest review comments. Here is the status of debugging the Windows failures.
|
IINM the plain windows job is really using cygwin (therefore emulating a unix system). MSVC is native windows and so the paths will be windows based. |
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.
one very minor grammar suggestion
doc/tests.rst
Outdated
the standard BUILD_PATH_PREFIX_MAP_ environment variable. For example: | ||
the standard BUILD_PATH_PREFIX_MAP environment variable. But one must | ||
be careful to encode the special delimeters (":", "=", "%") that might | ||
appear in the paths (e.g. on Windows). For example: |
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.
appear in the paths (e.g. on Windows). For example: | |
appear in the paths (e.g., on Windows). For example: |
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.
I have made your suggested correction in the latest push.
@gridbugs could you review this one? |
Why did you choose to reuse |
Sorry to take so long to respond (I've started a new job). Using a different root name is definitely a possibility. And in my more complete PR, #7540, files that would be installed (by In the separate PR, #7750, that introduces the
because a source file in the workspace may be installed when the debugger looks at it later. If we used
So it would be slightly more complex. I would be happy to use |
I have rebased, squashed, and force-pushed. |
To achieve reproducible builds, currently Dune rewrites paths based of the current build directory. However it misses paths based on the OCaml installation directory (usually ~/.opam/switch). This change also maps paths in the installation tree to abstract paths headed by "/workspace_root". In addition, added an "encode-prefix" command to the "dune_cmd" utility program. It uses the Build_path_prefix_map.encode_prefix function to encode its input and outputs it. This is needed in test scripts that construct a BUILD_PATH_PREFIX_MAP by mand. Modified tests that construct BUILD_PATH_PREFIX_MAP to use "dune_cmd encode-prefix" as needed. Signed-off-by: Richard L Ford <[email protected]>
Signed-off-by: Richard L Ford <[email protected]>
To achieve reproducible builds, currently Dune rewrites paths based on the current build directory. However, it misses paths based on the OCaml installation directory (usually ~/.opam/switch).
This change also maps paths in the installation tree to abstract paths headed by "/workspace_root".