mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
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.
This commit is contained in:
parent
bcce83c785
commit
98173af522
2 changed files with 7 additions and 4 deletions
|
@ -283,7 +283,8 @@ (define disallow-implicit-load?
|
||||||
("guix.scm" (alist-cons 'load `(package ,file) opts))
|
("guix.scm" (alist-cons 'load `(package ,file) opts))
|
||||||
("manifest.scm" (alist-cons 'manifest file opts))))
|
("manifest.scm" (alist-cons 'manifest file opts))))
|
||||||
(begin
|
(begin
|
||||||
(warning (G_ "not loading '~a' because not authorized to do so~%")
|
(report-error
|
||||||
|
(G_ "not loading '~a' because not authorized to do so~%")
|
||||||
file)
|
file)
|
||||||
(display-hint (format #f (G_ "To allow automatic loading of
|
(display-hint (format #f (G_ "To allow automatic loading of
|
||||||
@file{~a} when running @command{guix shell}, you must explicitly authorize its
|
@file{~a} when running @command{guix shell}, you must explicitly authorize its
|
||||||
|
@ -295,7 +296,7 @@ (define disallow-implicit-load?
|
||||||
file
|
file
|
||||||
(dirname file)
|
(dirname file)
|
||||||
(authorized-directory-file)))
|
(authorized-directory-file)))
|
||||||
opts))))))
|
(exit 1)))))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
|
|
@ -39,7 +39,9 @@ guix shell --bootstrap --pure guile-bootstrap -- guile --version
|
||||||
cat > "$tmpdir/guix.scm" <<EOF
|
cat > "$tmpdir/guix.scm" <<EOF
|
||||||
This is a broken guix.scm file.
|
This is a broken guix.scm file.
|
||||||
EOF
|
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.
|
# Authorize the directory.
|
||||||
echo "$(realpath "$tmpdir")" > "$configdir/guix/shell-authorized-directories"
|
echo "$(realpath "$tmpdir")" > "$configdir/guix/shell-authorized-directories"
|
||||||
|
|
Loading…
Reference in a new issue