summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-06 10:47:25 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-06 10:50:39 +0100
commit7949c140b10184f82247ea10fbbb344ecd097924 (patch)
treed77906b13ac518cf8f9921dc26d002e0ca2c3646
parent5ad13e6cdf77311b3c1ea93d45378f7e92081145 (diff)
downloadguix-7949c140b10184f82247ea10fbbb344ecd097924.tar.gz
ui: 'load*' no longer fails on Guile 2.2.3 upon EACCES or similar.
Previously, if ~/.cache was not write-accessible, 'guix' would exit with
code 1 without printing any message.  That was because the 'make-stack'
call would fail since the exception (a 'system-error) came from
'compile-file', which was called at a point where TAG wasn't installed
yet.  Secondly, to mimick auto-compilation behavior, we just swallow
'system-error raised by 'compile-file'.

Reported by Clément Lassieur.

* guix/ui.scm (load*): Move 'compile-file' call in the dynamic extent of
TAG.  Catch 'system-error around it and ignore it.
-rw-r--r--guix/ui.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 221bb82b7e..a4943c2a7f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -204,9 +204,8 @@ messages."
       ;; avoid ABI breakage in the user's config file, we explicitly compile
       ;; it (the problem remains if the user's config is spread on several
       ;; modules.)  See <https://bugs.gnu.org/29881>.
-      (if (string=? (version) "2.2.3")
-          (compile-file file #:env user-module)
-          (set! %fresh-auto-compile #t))
+      (unless (string=? (version) "2.2.3")
+        (set! %fresh-auto-compile #t))
 
       (set! %load-should-auto-compile #t)
 
@@ -218,6 +217,12 @@ messages."
          (parameterize ((current-warning-port (%make-void-port "w")))
            (call-with-prompt tag
              (lambda ()
+               (when (string=? (version) "2.2.3")
+                 (catch 'system-error
+                   (lambda ()
+                     (compile-file file #:env user-module))
+                   (const #f)))              ;EACCES maybe, let's interpret it
+
                ;; Give 'load' an absolute file name so that it doesn't try to
                ;; search for FILE in %LOAD-PATH.  Note: use 'load', not
                ;; 'primitive-load', so that FILE is compiled, which then allows us