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

Adding way to mount unusual path in bwrap sandbox #3540

Merged
merged 1 commit into from
Sep 20, 2018
Merged

Conversation

ErwanGa
Copy link
Contributor

@ErwanGa ErwanGa commented Sep 12, 2018

- add usage OPAM_USER_PATH_RO environment variable for setting
unusual paths in mount bind_ro list

- remove some unusual path from the script (/nix/store /rw/usrlocal)

- fix problem of build in the sandbox
    Some modules generates an error if the complete infra of {opam_root}
    is not seen in the sandbox
         -> [ERROR] /work/CG-2.1/_build/_opam exists, but does not appear
            to be a valid opam root.....
     They also need to write in $(dirname $OPAM_SWITCH_PREFIX)/log
    =>
        Need to mount $(dirname $OPAM_SWITCH_PREFIX) in ro
    but need to mount $(dirname $OPAM_SWITCH_PREFIX)/log in rw

add_mounts ro "$(dirname $OPAM_SWITCH_PREFIX)/config.lock"
add_mounts ro "$(dirname $OPAM_SWITCH_PREFIX)/download-cache"
add_mounts ro "$(dirname $OPAM_SWITCH_PREFIX)/lock"
add_mounts ro "$(dirname $OPAM_SWITCH_PREFIX)/opam-init"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid there is some confusion between OPAMROOT which contains global configuration files and OPAM_SWITCH_PREFIX which contains local switch configuration and installation structure. It's the opam root that contains those files, not the switch prefix. Plus, at build stage, opam don't need to access to its opam root (if so, it's a packaging issue).
I've checked and I can confirm that it works as is: having opam root and opam switch in an unlisted directory, launching an install from another one unrelated.
What is you configuration? You can have internal values of root & switch with opam config list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok
Seems to be package issue.
Shall I do another pr without this part of the patch ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be package issue.

What is the package you tried to install?

Shall I do another pr without this part of the patch ?

No need to create a new one, you can update this PR by updating the branch you used. You can squash commits in order to have a clean history.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've such issue with package cpuid @ version 0.1.1.

I'll update the pr asap

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, cpuid can be installed as $HOME is ro mounted and it uses opam to access configuration (via ocb-stubblr, cf. above links). The ocb-stubblr PR is not yet merged fixing it, so meanwhile it still need to access opam root, but just in ro.
I tried using the new OPAM_USER_PATH_RO variable set to an unusual opam root and it installed with no problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood...
PR has been updated. It now only contains the OPAM_USER_PATH_RO patch

@rjbou
Copy link
Collaborator

rjbou commented Sep 12, 2018

Thanks for the contribution!

I'll ping @reynir to inform about the /rw/usrlocal change.

PR related to #3534.

    - add usage OPAM_USER_PATH_RO environement variable for setting
    unusual pathes in mount bind_ro list
    - remove some unusual path from the script (/nix/store /rw/usrlocal)
@ErwanGa ErwanGa changed the title Adding way to mount unusual path in bwrap sandbox + fix build issue Adding way to mount unusual path in bwrap sandbox Sep 13, 2018
@rjbou rjbou merged commit ad60d28 into ocaml:master Sep 20, 2018
@rjbou
Copy link
Collaborator

rjbou commented Sep 20, 2018

Thanks!

@rjbou rjbou mentioned this pull request Sep 20, 2018
rjbou pushed a commit to rjbou/opam that referenced this pull request Sep 25, 2018
- add usage OPAM_USER_PATH_RO environement variable for setting  unusual pathes in mount bind_ro list
- remove some unusual path from the script (/nix/store /rw/usrlocal)
rjbou pushed a commit to rjbou/opam that referenced this pull request Sep 25, 2018
- add usage OPAM_USER_PATH_RO environement variable for setting  unusual pathes in mount bind_ro list
- remove some unusual path from the script (/nix/store /rw/usrlocal)
rjbou pushed a commit to rjbou/opam that referenced this pull request Oct 16, 2018
- add usage OPAM_USER_PATH_RO environement variable for setting  unusual pathes in mount bind_ro list
- remove some unusual path from the script (/nix/store /rw/usrlocal)
rjbou pushed a commit to rjbou/opam that referenced this pull request Oct 17, 2018
- add usage OPAM_USER_PATH_RO environement variable for setting  unusual pathes in mount bind_ro list
- remove some unusual path from the script (/nix/store /rw/usrlocal)
@rjbou rjbou added this to the 2.0.1 milestone Jan 27, 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

Successfully merging this pull request may close these issues.

None yet

2 participants