Fix segfault in Unix.create_process on Windows 10#912
Conversation
|
Yeah, I saw the problem when doing the compatibility cleanup work. That
branch also fixes this.
|
|
Non-invasive patch fixing a segfault: of course this should go into 4.04. |
|
Should this get a If this is correct, please add a Changes entry. You should put it directly in the 4.04-branch section ("Next minor version") for easier cherry-picking. |
|
Actually, given that I'm working with 64-bit ports, I expect it's down to whether the pointer returned is actually 64-bits, so it may well not be Windows 10 specific. However, given the number of times I've run the testsuite recently (on VMs with both 2GB and 4GB RAM), it may have something to do with address layout on Windows 10. |
d7b262a to
471e815
Compare
a03df67 to
471e815
Compare
|
Does that look OK? Is it OK to cherry pick it and push directly to trunk (i.e. without a GPR)? |
|
Yes, I think that it's worth merging the present PR that minimally (and more explicitly) fixes the issue. Yes, you should just cherry-pick into 4.04 and push from the command-line -- a separate PR would add noise to all subscribers. Your Changelog entry looks fine. |
|
Yeah, sorry David for not having done that.
Given that it was just a warning and still did compile I didn't realise
how important it was. My mistake. Really sorry about that. :(
|
|
No, no - it's not your fault! I was kicking myself, because I reviewed that PR! |
|
Cherry-picked onto trunk as well (1f9608a) |
|
David Allsopp (2016/11/13 12:07 -0800):
I still think it owuld have deserved a separate PR and more emphasis put |
|
I wonder if there is something we can do to better catch those issues in the future. Can this kind of MSVC warnings be turned into errors? Should we try to add a Windows 10 machine to the CI arsenal? Another question: is there a chance that 4.04.0 users with C code could suffer from the same issue? Maybe they use internal stuff which is now undefined and, like we did, did not notice any issue at compilation time. Is that a realistic scenario, should we then warn the users (beside releasing a 4.04.1 eventually; cc @damiendoligez), and how can they reliably check if they are affected? |
|
Gabriel Scherer (2016/11/13 12:22 -0800):
Yes. And MinGW warnigns can (and I think should) also be turned into The problem encountered by David was actually reported under mingw. The thing is, there are a few warnings that need to be fixed, currently. And they are not obvious to fix, I am working precisely on that at the Once they are all fixed we can turn them into errors.
It could of course not hurt but I think if we have warning-free code
Could be.
I the code is warning-free I think it's okay. |
|
Oh, thanks for working on the issue. |
|
Yes, I agree that we should head towards all C warnings as errors - but it can be very difficult to keep both sets of compilers in sync - especially as there are multiple supported versions of Microsoft's still out there (VC 19 - the current version - has modern standards support, but the older versions are all C89) |
|
If it's easy to add another a machine doing Windows 10 testing, then yes - but otherwise, I shall remember to run the Windows tests on a Windows 10 box for 4.04.1/4.05.0. I hit this while doing some investigation into bleeding-edge support in Windows 10 for building native OCaml using Ubuntu-on-Windows (while it's still not as fast as Ubuntu itself, it's waaaaaay faster than Cygwin already!) which will hopefully eventually feed into CI running Azure (which would be Windows 10 or Server 2016) |
|
Perhaps it's not such a big deal to restrict ourselves to the part of C
which is widely understood?
Or, in other words, perhaps that burden (or the one of having a few
ifdefs in the code to adapt the code to the compiler where this hel)s)
is preferable to the current situation?
|
|
@shindere C89 is very very old. A few years ago we made an explicit decision to switch to C99 (which is only very old) after checking that the MS compiler would mostly support it. If we were modern, we would switch to C11... |
|
This bug now has a Mantis issue: MPR#7422. |
|
@dra27 I just tried adding a Win10 machine to CI, and failed. It doesn't seem to be supported by Inria's CI yet. |
#656 didn't add
#define CAML_INTERNALSto the top of otherlibs/win32unix/createprocess.c which means that its import ofsearch_exe_in_pathgets a default definition meaning it gets a default return type ofintinstead ofchar *(certainly MSVC emits a warning - I didn't look at gcc).This appears to be innocuous on Windows 7, but on Windows 10 its causing segfaults (lib-scanf-2 and all the debugger tests failing).
This should probably be pushed to 4.04 as well? (@damiendoligez ?)