mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-11 13:49:23 -05:00
ui: 'load*' correctly reports 'read-error' in all cases.
Previously, 'read-error' exceptions other than "missing closing paren" would not be reported; instead, we'd directly call (exit 1) without printing anything. Fixes <https://issues.guix.gnu.org/51463>. Reported by Alice BRENON <alice.brenon@ens-lyon.fr>. * guix/ui.scm (report-load-error): Report the error without re-throwing upon 'read-error'. * tests/guix-build.sh: Add test.
This commit is contained in:
parent
dab2ac2ed5
commit
4d59596a1c
2 changed files with 13 additions and 2 deletions
|
@ -377,7 +377,8 @@ (define* (report-load-error file args #:optional frame)
|
||||||
(+ 2 (string-contains message ": ")))))
|
(+ 2 (string-contains message ": ")))))
|
||||||
(format (current-error-port) (G_ "~amissing closing parenthesis~%")
|
(format (current-error-port) (G_ "~amissing closing parenthesis~%")
|
||||||
location))
|
location))
|
||||||
(apply throw args)))
|
(report-error (G_ "read error while loading '~a': ~a~%")
|
||||||
|
file (apply format #f message args))))
|
||||||
(('syntax-error proc message properties form subform . rest)
|
(('syntax-error proc message properties form subform . rest)
|
||||||
(let ((loc (source-properties->location properties)))
|
(let ((loc (source-properties->location properties)))
|
||||||
(report-error loc (G_ "~s: ~a~%")
|
(report-error loc (G_ "~s: ~a~%")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# GNU Guix --- Functional package management for GNU
|
# GNU Guix --- Functional package management for GNU
|
||||||
# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
# Copyright © 2012, 2013, 2014, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
|
||||||
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
|
||||||
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
|
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
|
||||||
#
|
#
|
||||||
|
@ -77,6 +77,16 @@ module_dir="t-guix-build-$$"
|
||||||
mkdir "$module_dir"
|
mkdir "$module_dir"
|
||||||
trap "rm -rf $module_dir" EXIT
|
trap "rm -rf $module_dir" EXIT
|
||||||
|
|
||||||
|
# Check error reporting for '-f'.
|
||||||
|
cat > "$module_dir/foo.scm" <<EOF
|
||||||
|
(use-modules (guix))
|
||||||
|
) ;extra closing paren
|
||||||
|
EOF
|
||||||
|
! guix build -f "$module_dir/foo.scm" 2> "$module_dir/stderr"
|
||||||
|
grep "read error" "$module_dir/stderr"
|
||||||
|
rm "$module_dir/stderr" "$module_dir/foo.scm"
|
||||||
|
|
||||||
|
# Check 'GUIX_PACKAGE_PATH' & co.
|
||||||
cat > "$module_dir/foo.scm"<<EOF
|
cat > "$module_dir/foo.scm"<<EOF
|
||||||
(define-module (foo)
|
(define-module (foo)
|
||||||
#:use-module (guix tests)
|
#:use-module (guix tests)
|
||||||
|
|
Loading…
Reference in a new issue