diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-04-04 00:00:41 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-04-04 00:10:00 +0200 |
commit | 76c486196f299716be33df86d06b3ce2b79dd77f (patch) | |
tree | 660452112c065299779ab5aaab5ff6416c7fb316 /guix | |
parent | 3e43166ffc11fb117c55da594e57866a75625900 (diff) |
packages: Catch invalid input errors for structs.
Reported by Thomas Sigurdsen <thomas.sigurdsen@gmail.com>
at <https://lists.gnu.org/archive/html/help-guix/2017-04/msg00007.html>.
* guix/packages.scm (expand-input): Add 'guard' form around call to
'package-source-derivation'.
* tests/packages.scm (dummy): New test.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/packages.scm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index 61171b8342..b68b3de6d2 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -31,7 +31,6 @@ #:use-module (guix memoization) #:use-module (guix build-system) #:use-module (guix search-paths) - #:use-module (guix gexp) #:use-module (guix sets) #:use-module (ice-9 match) #:use-module (ice-9 vlist) @@ -846,7 +845,16 @@ information in exceptions." ;; source. (list name (intern file))) (((? string? name) (? struct? source)) - (list name (package-source-derivation store source system))) + ;; 'package-source-derivation' calls 'lower-object', which can throw + ;; '&gexp-input-error'. However '&gexp-input-error' lacks source + ;; location info, so we catch and rethrow here (XXX: not optimal + ;; performance-wise). + (guard (c ((gexp-input-error? c) + (raise (condition + (&package-input-error + (package package) + (input (gexp-error-invalid-input c))))))) + (list name (package-source-derivation store source system)))) (x (raise (condition (&package-input-error (package package) |