[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/08: style: Gracefully handle failure to locate a source file.
From: |
guix-commits |
Subject: |
03/08: style: Gracefully handle failure to locate a source file. |
Date: |
Mon, 11 Jul 2022 19:19:22 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit b8b02f4de5136d4385f36a79e727c90cb0ba1951
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Jul 11 23:02:48 2022 +0200
style: Gracefully handle failure to locate a source file.
* guix/scripts/style.scm (absolute-location): Raise an error when
'search-path' returns #f.
---
guix/scripts/style.scm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
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)))
- branch master updated (5ecbf5b163 -> 8d922504b2), guix-commits, 2022/07/11
- 01/08: gnu: xonsh: Update to 0.13.0, guix-commits, 2022/07/11
- 03/08: style: Gracefully handle failure to locate a source file.,
guix-commits <=
- 06/08: gnu: LLVM, Clang, LLD: Update to 14.0.6., guix-commits, 2022/07/11
- 07/08: gnu: clang-toolchain-14: Build with libomp-14., guix-commits, 2022/07/11
- 04/08: gnu: llvm-8: Fix build with gcc-10., guix-commits, 2022/07/11
- 05/08: gnu: llvm-3.7, llvm-3.8: Fix build with gcc., guix-commits, 2022/07/11
- 02/08: guix: Really export 'define-public'., guix-commits, 2022/07/11
- 08/08: gnu: home: Add Guix channels service., guix-commits, 2022/07/11