From 21391f8c83658797c9bfbc3ef8a552859e9d861d Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Tue, 24 Sep 2019 20:57:34 -0500 Subject: compile: Fix race condition on completion progress. This prevent a race condition where multiple compilation threads could report the same progress. * guix/build/compile.scm (compile-files): Rename to... : ...this. Increment in same mutex region as the compilation is reported. --- guix/build/compile.scm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'guix/build') diff --git a/guix/build/compile.scm b/guix/build/compile.scm index c127456fd0..06ed57c9d7 100644 --- a/guix/build/compile.scm +++ b/guix/build/compile.scm @@ -169,11 +169,12 @@ BUILD-DIRECTORY, using up to WORKERS parallel workers. The resulting object files are for HOST, a GNU triplet such as \"x86_64-linux-gnu\"." (define progress-lock (make-mutex)) (define total (length files)) - (define completed 0) + (define progress 0) (define (build file) (with-mutex progress-lock - (report-compilation file total completed)) + (report-compilation file total progress) + (set! progress (+ 1 progress))) ;; Exit as soon as something goes wrong. (exit-on-exception @@ -185,9 +186,7 @@ files are for HOST, a GNU triplet such as \"x86_64-linux-gnu\"." #:output-file (string-append build-directory "/" (scm->go relative)) #:opts (append warning-options - (optimization-options relative))))))) - (with-mutex progress-lock - (set! completed (+ 1 completed)))) + (optimization-options relative)))))))) (with-augmented-search-path %load-path source-directory (with-augmented-search-path %load-compiled-path build-directory -- cgit v1.2.3 From 7089f98ef1c274f1607ec314f3a16bd3c3ac89a4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 19 Jul 2019 00:52:36 +0200 Subject: syscalls: 'define-as-needed' does not re-export local variables. Fixes . Reported by Timothy Sample . * guix/build/syscalls.scm (define-as-needed): Rewrite to use lower-level module primitives; define VARIABLE only if it's not already defined to avoid "re-exporting local variable" error. --- guix/build/syscalls.scm | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'guix/build') diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 3c84d3893f..f2fdb4d9d1 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -396,17 +396,11 @@ the returned procedure is called." ((_ (proc args ...) body ...) (define-as-needed proc (lambda* (args ...) body ...))) ((_ variable value) - (begin - (when (module-defined? the-scm-module 'variable) - (re-export variable)) - - (define variable - (if (module-defined? the-scm-module 'variable) - (module-ref the-scm-module 'variable) - value)) - - (unless (module-defined? the-scm-module 'variable) - (export variable)))))) + (if (module-defined? the-scm-module 'variable) + (module-re-export! (current-module) '(variable)) + (begin + (module-define! (current-module) 'variable value) + (module-export! (current-module) '(variable))))))) ;;; -- cgit v1.2.3