Skip to content
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

opam init error (2.1.0~beta2) when checking sandboxing (OPAM_SWITCH_PREFIX: unbound variable) #4420

Closed
gasche opened this issue Nov 5, 2020 · 3 comments

Comments

@gasche
Copy link
Member

gasche commented Nov 5, 2020

I'm running opam init from a fresh Ubunutu virtual machine with just the bare dependencies installed. I get the following message, which suggests a problem in the way opam checks whether sandboxing works.

[ERROR] Sandboxing is not working on your platform ubuntu:
        "~/.opam/opam-init/hooks/sandbox.sh build sh -c echo SUCCESS >/tmp/t &&
        cat /tmp/t" exited with code 1
        "/home/gscherer/.opam/opam-init/hooks/sandbox.sh: ligne 96:
        OPAM_SWITCH_PREFIX : variable sans liaison"

My understanding is that opam init tries to check whether sandbox.sh works, but then the script fails because OPAM_SWITCH_PREFIX is undefined, which I expect is standard if opam init has not run ever yet on the machine. Interpreting this as a failure of sandboxing (and then suggesting that users disable it) looks like a UI bug to me; opam init should instead check sandboxing in a more robust way.


The opam config report output is as follows:

# opam config report
# opam-version         2.1.0~beta2 
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=ubuntu os-version=18.04
[ERROR] Opam has not been initialised, please run `opam init'
# read-state           OpamStd.OpamSys.Exit(50)
@gasche
Copy link
Member Author

gasche commented Nov 5, 2020

I do not get this error with opam 2.0.7 on the same system.

@rjbou
Copy link
Collaborator

rjbou commented Nov 5, 2020

Indeed, it a beta2 new feature (cf. #4284). This problem is fixed in #4370, and be available in next beta.
Thanks for the report!

@rjbou rjbou closed this as completed Nov 5, 2020
@gasche
Copy link
Member Author

gasche commented Nov 5, 2020

Ah, sorry for missing the two other issue reports (I did look for OPAM_SWITCH_PREFIX... and then did not use it in my own issue title), #4397 and #4368, and thanks for the quick triaging.

@gasche gasche changed the title opam init error (2.1.0~beta2) when checking sandboxing opam init error (2.1.0~beta2) when checking sandboxing (OPAM_SWITCH_PREFIX: unbound variable) Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants