From c879354003df61703c4b6c874650608bf569d77d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 7 Dec 2021 11:35:42 +0100 Subject: shell: Fix '--file' description in '--help' output. Reported by pinoaffe on #guix. * guix/scripts/shell.scm (show-help): Fix '--file' description. --- guix/scripts/shell.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'guix/scripts') diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm index bd62803cb1..7cd7ce78e1 100644 --- a/guix/scripts/shell.scm +++ b/guix/scripts/shell.scm @@ -52,8 +52,7 @@ interactive shell in that environment.\n")) (display (G_ " -D, --development include the development inputs of the next package")) (display (G_ " - -f, --file=FILE create environment for the package that the code within - FILE evaluates to")) + -f, --file=FILE add to the environment the package FILE evaluates to")) (display (G_ " -q inhibit loading of 'guix.scm' and 'manifest.scm'")) (display (G_ " -- cgit v1.2.3 From 71977101218d1fd5d7f5016cbbcb8710be057d49 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 10 Dec 2021 12:26:29 +0100 Subject: 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(-) (limited to 'guix/scripts') diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm index 7cd7ce78e1..546639818f 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 3bdf625189..d8cae9d614 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. -- cgit v1.2.3 From 16e9e538386bf30da690502c65b8053ff266e8cb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 10 Dec 2021 12:27:58 +0100 Subject: environment: Suggestion code gracefully handles empty "/bin" directories. * guix/scripts/environment.scm (suggest-command-name): Handle the case where 'scandir' returns #f. --- guix/scripts/environment.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix/scripts') diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 821f20e2f2..510cee727f 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -567,7 +567,7 @@ command name." (_ #t))) (match (scandir (string-append profile "/bin") not-dot?) - (() #f) + ((or #f ()) #f) (available (match command ((executable _ ...) -- cgit v1.2.3