From 71977101218d1fd5d7f5016cbbcb8710be057d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 10 Dec 2021 12:26:29 +0100 Subject: [PATCH] shell: When using '-D -f', '-D' has no effect on remaining packages. Fixes . Reported by Konrad Hinsen . * guix/scripts/shell.scm (%options): In "--file" handler, add call to 'ensure-ad-hoc'. * tests/guix-shell.sh: Add test. --- guix/scripts/shell.scm | 2 +- tests/guix-shell.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm index 7cd7ce78e1d49bd3a2a326f514dd59a9c9efe693..546639818f19e696d1b34bd15c8131649d2a1ed7 100644 --- a/guix/scripts/shell.scm +++ b/guix/scripts/shell.scm @@ -115,7 +115,7 @@ interactive shell in that environment.\n")) (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))) diff --git a/tests/guix-shell.sh b/tests/guix-shell.sh index 3bdf625189cc4d34b4efbce59d252b583e249520..d8cae9d61439f40517fec127068f0256012ec066 100644 --- a/tests/guix-shell.sh +++ b/tests/guix-shell.sh @@ -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: . +cat > "$tmpdir/empty-package.scm" < /dev/null then # Compute the build environment for the initial GNU Make.