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.
This commit is contained in:
Ludovic Courtès 2018-03-06 10:47:25 +01:00
parent 5ad13e6cdf
commit 7949c140b1
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 8 additions and 3 deletions

View File

@ -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