summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorTimothy Sample <samplet@ngyro.com>2018-12-16 23:12:13 -0500
committerLudovic Courtès <ludo@gnu.org>2018-12-18 16:04:25 +0100
commit6616a35202378dd8d33fcf5f32ca57ee08e1a09e (patch)
tree819be41c7f06bfc61a69769b0a95913f28c58ad9 /guix
parent83d4da1211e8c5cdae10f228605f707f307d02c7 (diff)
downloadgnu-guix-6616a35202378dd8d33fcf5f32ca57ee08e1a09e.tar
gnu-guix-6616a35202378dd8d33fcf5f32ca57ee08e1a09e.tar.gz
ui: Report file names in 'system-error' exceptions from 'execlp'.
Fixes <https://bugs.gnu.org/33755>. * guix/ui.scm (apply-formals): New macro. (execlp): New error-reporting wrapper. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix')
-rw-r--r--guix/ui.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 60636edac0..148c181039 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -502,14 +502,19 @@ General help using GNU software: <http://www.gnu.org/gethelp/>"))
(list (strerror (car errno)) file)
(list errno))))
-(define-syntax-rule (error-reporting-wrapper proc (args ...) file)
+(define-syntax apply-formals
+ (syntax-rules ()
+ ((_ proc (args ...)) (proc args ...))
+ ((_ proc (arg1 args ... . rest)) (apply proc arg1 args ... rest))))
+
+(define-syntax-rule (error-reporting-wrapper proc formals file)
"Wrap PROC such that its 'system-error' exceptions are augmented to mention
FILE."
(let ((real-proc (@ (guile) proc)))
- (lambda (args ...)
+ (lambda formals
(catch 'system-error
(lambda ()
- (real-proc args ...))
+ (apply-formals real-proc formals))
(augmented-system-error-handler file)))))
(set! symlink
@@ -528,6 +533,8 @@ FILE."
(set! delete-file
(error-reporting-wrapper delete-file (file) file))
+(set! execlp
+ (error-reporting-wrapper execlp (filename . args) filename))
(define (make-regexp* regexp . flags)
"Like 'make-regexp' but error out if REGEXP is invalid, reporting the error