summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2023-08-26 07:08:03 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-08-26 07:08:03 +0200
commit9d074e16c7a9879d67c348c7b2d70b725adfbdfa (patch)
treec4c8dc52508717b3b7aa7c988924a03aa6eb83d8 /guix/ui.scm
parentca7e310f7ac32354b2e693e9a0f783320952a8fc (diff)
parenteeb71d778f149834015858467fbeeb1276d96d1d (diff)
Merge branch 'master' into emacs-team
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 47a118364a..6f2d4fe245 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -200,6 +200,20 @@ information, or #f if it could not be found."
(parameterize (((@ (system base compile) default-optimization-level) 1))
exp))
+(define (try-canonicalize-path file)
+ "Like 'canonicalize-path', but return FILE as-is if 'canonicalize-path'
+throws.
+
+This is necessary for corner cases where 'canonicalize-path' fails. One
+example is on Linux when a /dev/fd/N file denotes a pipe, represented as a
+symlink to a non-existent file like 'pipe:[1234]', as in this example:
+
+ sh -c 'stat $(readlink -f /dev/fd/1)' | cat"
+ (catch 'system-error
+ (lambda ()
+ (canonicalize-path file))
+ (const file)))
+
(define* (load* file user-module
#:key (on-error 'nothing-special))
"Load the user provided Scheme source code FILE."
@@ -230,7 +244,7 @@ information, or #f if it could not be found."
;; 'primitive-load', so that FILE is compiled, which then allows
;; us to provide better error reporting with source line numbers.
(without-compiler-optimizations
- (load (canonicalize-path file))))
+ (load (try-canonicalize-path file))))
(const #f))))))
(lambda _
;; XXX: Errors are reported from the pre-unwind handler below, but