gnu: guile: Add 2.2.6-1 with a finalization crash bug-fix.
authorLudovic Courtès <ludo@gnu.org>
Mon, 9 Dec 2019 16:17:07 +0000 (17:17 +0100)
committerLudovic Courtès <ludo@gnu.org>
Mon, 9 Dec 2019 17:32:05 +0000 (18:32 +0100)
* gnu/packages/patches/guile-finalization-crash.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/guile.scm (guile-2.2/bug-fix): New variable.

gnu/local.mk
gnu/packages/guile.scm
gnu/packages/patches/guile-finalization-crash.patch [new file with mode: 0644]

index f1223e2..0faa0ba 100644 (file)
@@ -948,6 +948,7 @@ dist_patch_DATA =                                           \
   %D%/packages/patches/guile-2.2-skip-oom-test.patch            \
   %D%/packages/patches/guile-default-utf8.patch                        \
   %D%/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch  \
+  %D%/packages/patches/guile-finalization-crash.patch          \
   %D%/packages/patches/guile-linux-syscalls.patch              \
   %D%/packages/patches/guile-present-coding.patch              \
   %D%/packages/patches/guile-relocatable.patch                 \
index 3396899..9df008c 100644 (file)
@@ -250,6 +250,18 @@ without requiring the source code to be rewritten.")
             (variable "GUILE_LOAD_COMPILED_PATH")
             (files '("lib/guile/2.2/site-ccache")))))))
 
+(define-public guile-2.2/bug-fix
+  ;; This variant contains a bug fix for a relatively rare crash that could
+  ;; affect shepherd as PID 1: <https://bugs.gnu.org/37757>.
+  (package
+    (inherit guile-2.2)
+    (version (string-append (package-version guile-2.2) "-1"))
+    (source (origin
+              (inherit (package-source guile-2.2))
+              (patches
+               (append (search-patches "guile-finalization-crash.patch")
+                       (origin-patches (package-source guile-2.2))))))))
+
 (define-public guile-2.2/fixed
   ;; A package of Guile 2.2 that's rarely changed.  It is the one used
   ;; in the `base' module, and thus changing it entails a full rebuild.
diff --git a/gnu/packages/patches/guile-finalization-crash.patch b/gnu/packages/patches/guile-finalization-crash.patch
new file mode 100644 (file)
index 0000000..098249e
--- /dev/null
@@ -0,0 +1,61 @@
+commit edf5aea7ac852db2356ef36cba4a119eb0c81ea9
+Author: Ludovic Courtès <ludo@gnu.org>
+Date:   Mon Dec 9 14:44:59 2019 +0100
+
+    Fix non-deterministic crash in 'finalization_thread_proc'.
+    
+    Fixes <https://bugs.gnu.org/37757>.
+    Reported by Jesse Gibbons <jgibbons2357@gmail.com>.
+    
+    * libguile/finalizers.c (finalization_thread_proc): Do not enter the
+    "switch (data.byte)" condition when data.n <= 0.
+
+diff --git a/libguile/finalizers.c b/libguile/finalizers.c
+index c5d69e8e3..94a6e6b0a 100644
+--- a/libguile/finalizers.c
++++ b/libguile/finalizers.c
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2012, 2013, 2014 Free Software Foundation, Inc.
++/* Copyright (C) 2012, 2013, 2014, 2019 Free Software Foundation, Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public License
+@@ -211,21 +211,26 @@ finalization_thread_proc (void *unused)
+       scm_without_guile (read_finalization_pipe_data, &data);
+       
+-      if (data.n <= 0 && data.err != EINTR) 
++      if (data.n <= 0)
+         {
+-          perror ("error in finalization thread");
+-          return NULL;
++          if (data.err != EINTR)
++            {
++              perror ("error in finalization thread");
++              return NULL;
++            }
+         }
+-
+-      switch (data.byte)
++      else
+         {
+-        case 0:
+-          scm_run_finalizers ();
+-          break;
+-        case 1:
+-          return NULL;
+-        default:
+-          abort ();
++          switch (data.byte)
++            {
++            case 0:
++              scm_run_finalizers ();
++              break;
++            case 1:
++              return NULL;
++            default:
++              abort ();
++            }
+         }
+     }
+ }