commit:     7b16ed130f2ab2a38562726023fda23d40634038
Author:     Neula <thomas <AT> famsim <DOT> de>
AuthorDate: Sun Oct 28 13:45:08 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Oct 29 11:42:31 2018 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=7b16ed13

net-fs/autofs: fix segfault when using automount with --debug flag

 net-fs/autofs/autofs-5.1.4.ebuild                  |  3 +-
 .../files/autofs-early-pthread_key_create.patch    | 42 ++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/net-fs/autofs/autofs-5.1.4.ebuild 
b/net-fs/autofs/autofs-5.1.4.ebuild
index 3546185..71bf379 100644
--- a/net-fs/autofs/autofs-5.1.4.ebuild
+++ b/net-fs/autofs/autofs-5.1.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -47,6 +47,7 @@ CONFIG_CHECK="~AUTOFS4_FS"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-musl.patch
+       "${FILESDIR}"/${PN}-early-pthread_key_create.patch
 )
 
 src_prepare() {

diff --git a/net-fs/autofs/files/autofs-early-pthread_key_create.patch 
b/net-fs/autofs/files/autofs-early-pthread_key_create.patch
new file mode 100644
index 0000000..6e59812
--- /dev/null
+++ b/net-fs/autofs/files/autofs-early-pthread_key_create.patch
@@ -0,0 +1,42 @@
+Fixes segfault when launching autofs with debugging info
+
+--- autofs-5.1.4/daemon/automount.c    2017-12-19 03:46:44.000000000 +0100
++++ autofs-5.1.4/daemon/automount.c    2018-10-28 12:45:28.388254819 +0100
+@@ -2495,16 +2495,10 @@ int main(int argc, char *argv[])
+               macro_free_global_table();
+               exit(1);
+       }
+-
+-      info(logging, "Starting automounter version %s, master map %s",
+-              version, master_list->name);
+-      info(logging, "using kernel protocol version %d.%02d",
+-              get_kver_major(), get_kver_minor());
+-
+-      status = pthread_key_create(&key_thread_stdenv_vars,
+-                              key_thread_stdenv_vars_destroy);
++      
++      status = pthread_key_create(&key_thread_attempt_id, free);
+       if (status) {
+-              logerr("%s: failed to create thread data key for std env vars!",
++              logerr("%s: failed to create thread data key for attempt ID!",
+                      program);
+               master_kill(master_list);
+               res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
+@@ -2513,10 +2507,15 @@ int main(int argc, char *argv[])
+               macro_free_global_table();
+               exit(1);
+       }
++      info(logging, "Starting automounter version %s, master map %s",
++              version, master_list->name);
++      info(logging, "using kernel protocol version %d.%02d",
++              get_kver_major(), get_kver_minor());
+ 
+-      status = pthread_key_create(&key_thread_attempt_id, free);
++      status = pthread_key_create(&key_thread_stdenv_vars,
++                              key_thread_stdenv_vars_destroy);
+       if (status) {
+-              logerr("%s: failed to create thread data key for attempt ID!",
++              logerr("%s: failed to create thread data key for std env vars!",
+                      program);
+               master_kill(master_list);
+               res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));

Reply via email to