-
Notifications
You must be signed in to change notification settings - Fork 359
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
On init, check and propose to disable sandboxing if tool present & not working (docker, chroot, WLS1, etc.) #4284
Conversation
ping @mato? |
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.
Seems good, see comments for fields where I'd have liked it differently, but you may not have had better options.
src/client/opamClient.ml
Outdated
@@ -752,6 +752,62 @@ let init_checks ?(hard_fail_exn=true) init_config = | |||
if hard_fail && hard_fail_exn then OpamStd.Sys.exit_because `Configuration_error | |||
else not (soft_fail || hard_fail) | |||
|
|||
(* Check sandboxing script call. If it errors or unattended output, disable |
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 I would have chosen this module for this, since it's at the moment concerned with package-handling stuff and the switch state... but I don't have a much better proposition ?
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.
moved to OpamAuxCommand
src/client/opamClient.ml
Outdated
OpamSysPoll.variables >>= Lazy.force) | ||
in | ||
match OpamFilter.commands env sdbx_wrappers with | ||
| [] -> config |
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.
Too bad we can't use the code of OpamAction
here :/
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.
Added OpamEnv.hook_env
…don't fail on simple command), and propose to disable it if so
See ocaml#4284 I was getting: ``` % OPAMROOT=/tmp/egex opam init [NOTE] Will configure from built-in defaults. [ERROR] Sandboxing is not working on your platform debian: "/tmp/egex/opam-init/hooks/sandbox.sh": command not found. ```
The check is done by calling the sandbox script with
sandbox <action> sh -c "echo SUCCESS >/tmp/t && cat /tmp/t"
, and checking that stdout isSUCCESS
.Disabling is done by removing from global config sandboxing wrappers, default ones, defined in
OpamInitDefaults.sandbox_wrappers
.