diff --git a/guix/ui.scm b/guix/ui.scm index 6dfc8c7a5b..3c8734a7d5 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -257,6 +257,15 @@ ARGS is the list of arguments received by the 'throw' handler." (('system-error . rest) (let ((err (system-error-errno args))) (report-error (G_ "failed to load '~a': ~a~%") file (strerror err)))) + (('read-error "scm_i_lreadparen" message _ ...) + ;; Guile's missing-paren messages are obscure so we make them more + ;; intelligible here. + (if (string-suffix? "end of file" message) + (let ((location (string-drop-right message + (string-length "end of file")))) + (format (current-error-port) (G_ "~amissing closing parenthesis~%") + location)) + (apply throw args))) (('syntax-error proc message properties form . rest) (let ((loc (source-properties->location properties))) (format (current-error-port) (G_ "~a: error: ~a~%") diff --git a/tests/guix-system.sh b/tests/guix-system.sh index d575795ea0..31ee637133 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -53,6 +53,21 @@ else fi +cat > "$tmpfile"< "$errorfile" +then + # This must not succeed. + exit 1 +else + grep "$tmpfile:4:1: missing closing paren" "$errorfile" +fi + + # Reporting of unbound variables. cat > "$tmpfile" <