You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While debugging ocurrent/opam-repo-ci#120, @AltGr brought to my attention that some of the opam library functions (mainly OpamProcess.create and OpamSystem.real_path used in OpamFilename.Dir.of_string) use Unix.chdir twice (once to go in the directory and the second to go back to the previous directory) and are thus not thread-safe.
For OpamProcess.create it should be easy to fix: simply use Unix.fork + Unix.execve manually instead of Unix.create_process_env, but OpamSystem.real_path seems more tedious to reimplement.
OCaml 4.13 added Unix.realpath to do just that (Add Unix.realpath. ocaml#10047, thanks @dbuenzli ❤️) so maybe it would be "good enough" to use this function when OCaml 4.13 is detected and the legacy (2012!) code otherwise.
It's not quite as simple as reverting to fork because, alas, Windows - however CreateProcess has a parameter for specifying the working directory for the newly created process, so it's still eminently solvable!
For OpamSystem.real_path I agree - let's move the wrapper to OpamCompat so 4.13+ gets the superior support?
While debugging ocurrent/opam-repo-ci#120, @AltGr brought to my attention that some of the opam library functions (mainly
OpamProcess.create
andOpamSystem.real_path
used inOpamFilename.Dir.of_string
) useUnix.chdir
twice (once to go in the directory and the second to go back to the previous directory) and are thus not thread-safe.For
OpamProcess.create
it should be easy to fix: simply useUnix.fork
+Unix.execve
manually instead ofUnix.create_process_env
, butOpamSystem.real_path
seems more tedious to reimplement.Unix.realpath
to do just that (Add Unix.realpath. ocaml#10047, thanks @dbuenzli ❤️) so maybe it would be "good enough" to use this function when OCaml 4.13 is detected and the legacy (2012!) code otherwise.The text was updated successfully, but these errors were encountered: