From 07254feb24d755a01c63b64c1df1bfb68ac469bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 14 Jun 2014 23:23:56 +0200 Subject: [PATCH] ui: Avoid circularity with (guix gexp). Fixes a regression introduced in 56b8210 ("guix build: Allow gexps to be passed to '-e'.") * guix/ui.scm (%guix-user-module): Wrap in 'delay'. (read/eval): Adjust accordingly. --- guix/ui.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/guix/ui.scm b/guix/ui.scm index beb41e925a..7338b82401 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -240,11 +240,13 @@ (define (call-with-error-handling thunk) (define %guix-user-module ;; Module in which user expressions are evaluated. - (let ((module (make-module))) - (beautify-user-module! module) - ;; Use (guix gexp) so that one can use #~ & co. - (module-use! module (resolve-interface '(guix gexp))) - module)) + ;; Compute lazily to avoid circularity with (guix gexp). + (delay + (let ((module (make-module))) + (beautify-user-module! module) + ;; Use (guix gexp) so that one can use #~ & co. + (module-use! module (resolve-interface '(guix gexp))) + module))) (define (read/eval str) "Read and evaluate STR, raising an error if something goes wrong." @@ -256,7 +258,7 @@ (define (read/eval str) str args))))) (catch #t (lambda () - (eval exp %guix-user-module)) + (eval exp (force %guix-user-module))) (lambda args (leave (_ "failed to evaluate expression `~a': ~s~%") exp args)))))