diff mbox series

[bug#53063,wip-harden-installer,06/14] installer: Disable automatic finalization for child thread.

Message ID 17c53526bb7d92f07515a6c2cc165e717aa21346.1641507696.git.dev@jpoiret.xyz
State Accepted
Headers show
Series General improvements to the installer | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Josselin Poiret Jan. 6, 2022, 10:48 p.m. UTC
* gnu/installer/utils.scm (run-external-command-with-handler): Disable
finalization manually, to avoid having the finalizer thread spout
"error in finalization thread: Success".
---
 gnu/installer/utils.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
index 878434f074..ad220492d9 100644
--- a/gnu/installer/utils.scm
+++ b/gnu/installer/utils.scm
@@ -32,6 +32,8 @@  (define-module (gnu installer utils)
   #:use-module (ice-9 regex)
   #:use-module (ice-9 format)
   #:use-module (ice-9 textual-ports)
+  #:use-module (system foreign)
+  #:use-module (system foreign-library)
   #:export (read-lines
             read-all
             nearest-exact-integer
@@ -143,6 +145,14 @@  (define* (run-external-command-with-handler handler command)
     (match (primitive-fork)
       (0 ;; We're in the child
        (close-port input)
+       ;; XXX: Disable automatic finalization because we're going to exec.
+       ;; Might become unnecessary with newer Guile versions, as the
+       ;; *possible* finalization thread may stop properly when its pipe is
+       ;; closed.
+       ((foreign-library-function (load-foreign-library #f)
+                                  "scm_set_automatic_finalization_enabled"
+                                  #:return-type int
+                                  #:arg-types (list int)) 0)
        (reset-fds
         (open-fdes "/dev/null" O_WRONLY)
         ;; Avoid port GC'ing closing the fd by increasing its revealed count.