diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-04-04 23:38:45 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-05-05 14:33:59 +0200 |
commit | ce363c1dc7bd63a74dcf7788d340819f6d5db89f (patch) | |
tree | 74d42146b5cbaa91d713bc5ba5e319e225cc6e1b /tests | |
parent | 7d28e6512c6a33f3d4d794c78b2937beacf99f0f (diff) |
environment: Add ‘--writable-root’ and default to read-only root.
This is an incompatible change where the root file system in
‘guix shell -C’ is now read-only by default.
* guix/scripts/environment.scm (show-environment-options-help)
(%options): Add ‘--writable-root’.
* guix/scripts/environment.scm (setup-fhs): Invoke /sbin/ldconfig; moved
from…
(launch-environment): … here.
(launch-environment/container): Add #:writable-root? and pass it to
‘call-with-container’. Move root file system setup to #:populate-file-system.
(guix-environment*): Honor ‘--writable-root’.
* tests/guix-environment-container.sh: Test it.
* doc/guix.texi (Invoking guix shell): Document ‘--writable-root’.
(Debugging Build Failures): Mention it before “rm /bin/sh”.
Change-Id: I2e8517d6f01eb8093160bffc0f9f56071ad6fee6
Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/guix-environment-container.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index 09704f751c..d6cb382de9 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh @@ -1,7 +1,7 @@ # GNU Guix --- Functional package management for GNU # Copyright © 2015 David Thompson <davet@gnu.org> # Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com> -# Copyright © 2023 Ludovic Courtès <ludo@gnu.org> +# Copyright © 2023, 2025 Ludovic Courtès <ludo@gnu.org> # # This file is part of GNU Guix. # @@ -186,6 +186,15 @@ HOME="$tmpdir" guix environment --bootstrap --container --user=foognu \ -- /bin/sh -c 'test $(pwd) == "/home/foo" -a ! -d '"$tmpdir" ) +# Check that the root file system is read-only by default... +guix environment --bootstrap --container --ad-hoc guile-bootstrap \ + -- guile -c '(mkdir "/whatever")' && false + +# ... and can be made writable. +guix environment --bootstrap --container --ad-hoc guile-bootstrap \ + --writable-root \ + -- guile -c '(mkdir "/whatever")' + # Check the exit code. abnormal_exit_code=" |