shell: When using '-D -f', '-D' has no effect on remaining packages.

Fixes <https://issues.guix.gnu.org/52093>.
Reported by Konrad Hinsen <konrad.hinsen@fastmail.net>.

* guix/scripts/shell.scm (%options): In "--file" handler, add call to
'ensure-ad-hoc'.
* tests/guix-shell.sh: Add test.
This commit is contained in:
Ludovic Courtès 2021-12-10 12:26:29 +01:00
parent c879354003
commit 7197710121
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 15 additions and 1 deletions

View file

@ -115,7 +115,7 @@ (define %options
(option '(#\f "file") #t #f
(lambda (opt name arg result)
(alist-cons 'load (tag-package-arg result arg)
result)))
(ensure-ad-hoc result))))
(option '(#\q) #f #f
(lambda (opt name arg result)
(alist-cons 'explicit-loading? #t result)))

View file

@ -73,6 +73,20 @@ echo "Broken manifest." > "$tmpdir/manifest.scm"
(cd "$tmpdir"; SHELL="$(realpath fake-shell.sh)" guix shell --bootstrap -q)
rm "$tmpdir/manifest.scm"
# Make sure '-D' affects only the immediately following '-f', and not packages
# that appear later: <https://issues.guix.gnu.org/52093>.
cat > "$tmpdir/empty-package.scm" <<EOF
(use-modules (guix) (guix tests)
(guix build-system trivial))
(dummy-package "empty-package"
(build-system trivial-build-system)) ;zero inputs
EOF
guix shell --bootstrap --pure -D -f "$tmpdir/empty-package.scm" \
guile-bootstrap -- guile --version
rm "$tmpdir/empty-package.scm"
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
then
# Compute the build environment for the initial GNU Make.