-
Notifications
You must be signed in to change notification settings - Fork 184
fix setting Lwt_process env on Windows #967
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
base: master
Are you sure you want to change the base?
Conversation
|
Thanks a lot for the MR. I don't have a windows machine to test this on so I can't reproduce locally. Nevertheless, I'll be reviewing this MR soon. |
|
i dunno if you can get CI to run on the first diff (1d199cd) but it'll show the bug. for example: https://github.com/mroch/lwt/actions/runs/3284275234/jobs/5410034604 I believe the |
I don't know either. I don't understand github's UI very well. ❓ ❗ But that's ok. When I do the review I might push a branch with just the first commit to force the CI. |
MisterDA
left a comment
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.
Thanks for finding this and fixing the bug. The code is semantically identical to OCaml's Unix library, so I think this is good to go.
https://github.com/ocaml/ocaml/blob/c6d207656de19d97b5edf5c2f9028412aa218571/otherlibs/unix/createprocess.c#L120-L131
|
At first I was pleased that the code was so similar. I'll ask if it's ok. Basically, the added code is calling the functions provided by the ocaml project in the appropriate sequence. I think the alternative to using the same code is making a pull-request on the ocaml project to provide this sequence of calls as a function itself to be called. That might not be desirable upstream anyway… Anyway, I'll ask. |
|
A similar situation happened on the eio bugtracker: It's not exactly the same (not the same code being copied, not the same size of code) but it's also copying parts of the C code. |
|
I've made raphael-proust/ocaml@bdbddd2 which aims to expose the code that we actually need from the OCaml source. Please leave comments on there, I don't know that I did anything correctly. |
|
As per ocaml/ocaml#12492 (comment) it turns out licensing is not an issue. We can go ahead on this PR. |
|
This is long overdue ;) |
a93c0b9 to
a624a1c
Compare
|
Do we need to |
|
Hmm, apparently I accidentally allowed ocaml/ocaml#11449 to be closed by the stale bot. The issue is that It might be possible to work around it by explicitly including |
0d5c510 to
b8a722f
Compare
|
I made a few attempts but it's a pain to work on without access to a windows machine. I'll make a release which won't be available for 5.2 on windows (sorry) and I can make a point release later to fix this. |
See #967 Version 5.8.1 will be a point fix release for availability
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.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (3)
- src/unix/lwt_process_stubs.c: Language not supported
- test/unix/dummy.ml: Language not supported
- test/unix/test_lwt_process.ml: Language not supported
b8a722f to
455615a
Compare
|
rebased |
3937132 to
12d474f
Compare
|
CI errors: ocaml.5.4 windows-latest: ocaml.4.12.2 mingw ocaml.4.12.2 msvc I don't know yet what causes the error, I'm splitting the test suite a bit to try to find out. |
Missing an include of
The correct token is a double-equal |
@MisterDA i guess there's an include missing in the ocaml windows runtime files? i can still add the include anyway, but I guess I should still open an issue upstream, right? |
Not sure but I can check later. If |
|
The issue on msvc yields the error message the internet suggests this is a Access Violation error. Some sort of memory protection error. This seems to happen very early in the execution of the lwt_unix test suite. So it's either some initialisation stuff (like when it starts the runners or some other early process setup thing like that) or in one of the tests. This is getting a bit too specific to investigate in the CI, the feedback loop is too long. I'll inverstigate more with some VM if/when I have the bendwidth. PS: the mingw test now fails the same way (after the fix suggested by @MisterDA |
to avoid CAMLalloc_point_here not defined
|
still getting even though i'm timing out on this for now, gonna come back to it another time |
| #if OCAML_VERSION < 41300 | ||
| /* needed for caml_stat_strdup_to_os before ocaml 4.13, and for | ||
| caml_win32_multi_byte_to_wide_char, at least as of ocaml 5.0 */ | ||
| #define CAML_INTERNALS |
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.
if required, CAML_INTERNALS should always be used before every single includes. Using it halfway through will break the build (as discovered in your CI and in ocaml/ocaml#14491
envis an "environment block": a null-terminated block of null-terminated strings. usingcaml_stat_strdup_to_oson it doesn't work, it only copies the first string.instead, we need to use an explicit length (
caml_string_length(env)), but there's no public*_to_osfunction for this so we have to use the internalcaml_win32_multi_byte_to_wide_chardirectly.Fixes #966