From 7949c140b10184f82247ea10fbbb344ecd097924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 6 Mar 2018 10:47:25 +0100 Subject: ui: 'load*' no longer fails on Guile 2.2.3 upon EACCES or similar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- guix/ui.scm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'guix/ui.scm') 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 . - (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 -- cgit v1.2.3