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 complains that sandboxing isn't working on platform macports #4368

Closed
anuragsoni opened this issue Sep 19, 2020 · 4 comments · Fixed by #4370
Closed

Opam init complains that sandboxing isn't working on platform macports #4368

anuragsoni opened this issue Sep 19, 2020 · 4 comments · Fixed by #4370
Milestone

Comments

@anuragsoni
Copy link
Contributor

anuragsoni commented Sep 19, 2020

Hi,

I'm trying to use the opam 2.1 beta version (I tried both the published beta, and a version compiled from the current trunk) with a clean install. When I run opam init I see an error message about sandboxing not working.

% opam init --bare
[NOTE] Will configure from built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.

[ERROR] Sandboxing is not working on your platform macports:
        "~/.opam/opam-init/hooks/sandbox.sh build sh -c echo SUCCESS >/tmp/t && cat /tmp/t" exited with code 1
        "/Users/asoni/.opam/opam-init/hooks/sandbox.sh: line 61: OPAM_SWITCH_PREFIX: unbound variable"
Do you want to disable it?  Note that this will result in less secure package builds, so please ensure that you have some other isolation mechanisms in place
(such as running within a container or virtual machine). [y/N]

If I ignore the warning and continue by pressing N the install seems to succeed without issues. (opam doesn't automatically source the correct switch for me anymore even though the shell hooks have been installed, but the install overall seems to work fine).

I am using macOS 10.15 (Catalina) along with macports. This error wasn't present in the opam 2.0 series.
I'm wondering if this is an environment variable issue and I need to setup something to let Opam know about macports? It seems like the new depext integration is also having trouble finding dependencies like libffi via macports. It complains about them not being installed even though they are.

@rjbou rjbou added this to the 2.1.0~beta3 milestone Sep 21, 2020
@AltGr
Copy link
Member

AltGr commented Sep 21, 2020

This was a bug in the first beta, should be fixed in 2.1.0~beta2

@AltGr AltGr closed this as completed Sep 21, 2020
@anuragsoni
Copy link
Contributor Author

This was a bug in the first beta, should be fixed in 2.1.0~beta2

@AltGr The behavior i reported was seen with both 2.1.0~beta2 and with a version compiled from opam-trunk after the beta2 was released.

@rjbou
Copy link
Collaborator

rjbou commented Sep 21, 2020

Yes, the variable (OPAM_SWITCH_PREFIX) is not defined at init, in a fresh shell. A fix in opam is needed, not on your side. There is no link with depext, it's the new mechanism to check that the sandbox is usable on the current setup (docker, chroot). cf. #4284.

For depext / macports issues, there is an open one, about variants and their handling #4297. If it is nt the same problem, feel free to open a new one, like that we can investigate on it.

@rjbou rjbou reopened this Sep 21, 2020
@anuragsoni
Copy link
Contributor Author

@rjbou I agree that the depext issue is not related to this issue :) Sorry for the noise. #4297 could indeed be related and i'll take a look at that and open a separate issue if needed.

Thanks,
Anurag

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

Successfully merging a pull request may close this issue.

3 participants