aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/scripts/style.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index fd5f7f5c26..9fd652beb1 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -44,6 +44,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-34)
#:use-module (srfi srfi-37)
#:export (pretty-print-with-comments
read-with-comments
@@ -683,7 +684,16 @@ doing it."
"Replace the file name in LOC by an absolute location."
(location (if (string-prefix? "/" (location-file loc))
(location-file loc)
- (search-path %load-path (location-file loc)))
+
+ ;; 'search-path' might return #f in obscure cases, such as
+ ;; when %LOAD-PATH includes "." or ".." and LOC comes from a
+ ;; file in a subdirectory thereof.
+ (match (search-path %load-path (location-file loc))
+ (#f
+ (raise (formatted-message
+ (G_ "file '~a' not found on load path")
+ (location-file loc))))
+ (str str)))
(location-line loc)
(location-column loc)))