ocamlc overwrites /dev/null #11302
Comments
Details
Sorry, something went wrong.
|
If root runs the following commands: if then @marc-chevalier initially reported this is thierry-martinez/stdcompat#18: I can (and will) fix this by using a workaround in |
Details
Sorry, something went wrong.
|
Thanks for the report. The problem stems from this line Line 317 in cbfa40a
which deletes /dev/null (if you have sufficient permissions) before writing the output. This deletion was added in order to address #8354 (output file is left with existing permissions if it already exists on disk), so this needs to be looked at to figure out what's the best workaround.
|
Details
|
For comparison |
Details
This is a reasonable strategy, but we cannot implement it in ocamlc (currently) because the Let's not rush a fix. The "problem" has been with us since 2003, and sane users don't run compilers with superuser privileges. |
Details
|
In passing, #9787 proposed
|
Details
|
I'm not saying what I was doing is sane (pretty much the opposite: fighting with a very non OCaml-friendly environment and build system), but there is now a common situation where we can expect users to run about anything as root: docker. Not saying it's a good idea, but the simple normal and common setup is to be root inside the container, as far as I know. |
Details
It certainly doesn't need to be that way - deploying in Docker as root is one thing, but using it as a development environment, one should create a non-privileged user in the normal way. cf. the opam images at ocaml/opam on Docker hub which all have an |
Details
Details
Details
Details
Details
Agreed. I had a more complicated fix in mind, but here is a fix based on |
Details
Details
Sorry, something went wrong.
|
For the record, the alternate solution I had in mind is here: xavierleroy@d898922 . The good thing about this alternate solution is that the bytecode file generated by ocamlc is not executable until it's complete and ready for execution. The not so good thing is that the final permissions are harder to predict. |
Details