[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/06: shell: Error out when an unauthorized guix.scm/manifest.scm is fo
From: |
guix-commits |
Subject: |
02/06: shell: Error out when an unauthorized guix.scm/manifest.scm is found. |
Date: |
Sat, 30 Oct 2021 13:26:06 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 98173af5222ab5e879e44ba9521dec5416ba8c60
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Oct 30 16:35:06 2021 +0200
shell: Error out when an unauthorized guix.scm/manifest.scm is found.
The previous behavior was confusing: a warning would be printed and
'guix shell' would go on starting an empty environment.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.
* guix/scripts/shell.scm (auto-detect-manifest): Change "not loading"
case from warning to error.
* tests/guix-shell.sh: Adjust accordingly.
---
guix/scripts/shell.scm | 7 ++++---
tests/guix-shell.sh | 4 +++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm
index c7eba42..5749485 100644
--- a/guix/scripts/shell.scm
+++ b/guix/scripts/shell.scm
@@ -283,8 +283,9 @@ Return the modified OPTS."
("guix.scm" (alist-cons 'load `(package ,file) opts))
("manifest.scm" (alist-cons 'manifest file opts))))
(begin
- (warning (G_ "not loading '~a' because not authorized to do
so~%")
- file)
+ (report-error
+ (G_ "not loading '~a' because not authorized to do so~%")
+ file)
(display-hint (format #f (G_ "To allow automatic loading of
@file{~a} when running @command{guix shell}, you must explicitly authorize its
directory, like so:
@@ -295,7 +296,7 @@ echo ~a >> ~a
file
(dirname file)
(authorized-directory-file)))
- opts))))))
+ (exit 1)))))))
;;;
diff --git a/tests/guix-shell.sh b/tests/guix-shell.sh
index 95725cb..3bdf625 100644
--- a/tests/guix-shell.sh
+++ b/tests/guix-shell.sh
@@ -39,7 +39,9 @@ guix shell --bootstrap --pure guile-bootstrap -- guile
--version
cat > "$tmpdir/guix.scm" <<EOF
This is a broken guix.scm file.
EOF
-(cd "$tmpdir"; SHELL="$(type -P true)" guix shell --bootstrap)
+! (cd "$tmpdir"; SHELL="$(type -P true)" guix shell --bootstrap 2> "stderr")
+grep "not authorized" "$tmpdir/stderr"
+rm "$tmpdir/stderr"
# Authorize the directory.
echo "$(realpath "$tmpdir")" > "$configdir/guix/shell-authorized-directories"
- branch master updated (d444956 -> 142344b), guix-commits, 2021/10/30
- 01/06: gnu: Add Random Identity Generator (rig), guix-commits, 2021/10/30
- 03/06: gnu: Add python-ijson., guix-commits, 2021/10/30
- 06/06: gnu: qemu: Add Guix support to QEMU guest agent., guix-commits, 2021/10/30
- 02/06: shell: Error out when an unauthorized guix.scm/manifest.scm is found.,
guix-commits <=
- 04/06: gnu: Add r-fasterize., guix-commits, 2021/10/30
- 05/06: gnu: Add r-bien., guix-commits, 2021/10/30