commit:     ca424c044ad8c11f2b0838508e1fa1d3276fdb72
Author:     Kai Krakow <kai <AT> kaishome <DOT> de>
AuthorDate: Thu Apr 16 19:34:11 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Apr 17 15:10:32 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ca424c04

sys-fs/bees: Add musl hack to 0.6.1-r2

Package-Manager: Portage-2.3.89, Repoman-2.3.20
See-also: https://github.com/Zygo/bees/pull/143
Closes: https://bugs.gentoo.org/713960
Signed-off-by: Kai Krakow <kai <AT> kaishome.de>
Closes: https://github.com/gentoo/gentoo/pull/15374
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 sys-fs/bees/bees-0.6.1-r2.ebuild                   |  3 +-
 ...K-musl-does-not-define-pthread_getname_np.patch | 49 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/sys-fs/bees/bees-0.6.1-r2.ebuild b/sys-fs/bees/bees-0.6.1-r2.ebuild
index 38c83939e49..3f4ce0f69aa 100644
--- a/sys-fs/bees/bees-0.6.1-r2.ebuild
+++ b/sys-fs/bees/bees-0.6.1-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -33,6 +33,7 @@ PATCHES=(
        
"${FILESDIR}/6001-lib-fix-non-local-lambda-expression-cannot-have-a-ca.patch"
        
"${FILESDIR}/6002-context-workaround-to-prevent-LOGICAL_INO-and-btrfs-.patch"
        "${FILESDIR}/6003-process-Fix-gettid-ambiguity-with-glibc-2.30.patch"
+       "${FILESDIR}/0001-HACK-musl-does-not-define-pthread_getname_np.patch"
 )
 
 pkg_pretend() {

diff --git 
a/sys-fs/bees/files/0001-HACK-musl-does-not-define-pthread_getname_np.patch 
b/sys-fs/bees/files/0001-HACK-musl-does-not-define-pthread_getname_np.patch
new file mode 100644
index 00000000000..5f542956d88
--- /dev/null
+++ b/sys-fs/bees/files/0001-HACK-musl-does-not-define-pthread_getname_np.patch
@@ -0,0 +1,49 @@
+From ba43aef5e264abd4b24baa1ca9f042e30e565155 Mon Sep 17 00:00:00 2001
+From: Kai Krakow <[email protected]>
+Date: Thu, 16 Apr 2020 21:21:57 +0200
+Subject: [PATCH] HACK: musl does not define pthread_getname_np()
+
+The glibc alternative musl does not define this setter function. This
+fix is probably wrong because it resets the thread names used for
+logging internally to empty strings.
+
+Link: https://www.openwall.com/lists/musl/2019/07/17/3
+---
+ lib/task.cc | 2 ++
+ src/bees.cc | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/lib/task.cc b/lib/task.cc
+index 4bdaeec..5b03335 100644
+--- a/lib/task.cc
++++ b/lib/task.cc
+@@ -104,7 +104,9 @@ namespace crucible {
+ 
+               char buf[24];
+               memset(buf, '\0', sizeof(buf));
++#ifdef _GNU_SOURCE
+               DIE_IF_MINUS_ERRNO(pthread_getname_np(pthread_self(), buf, 
sizeof(buf)));
++#endif
+               Cleanup pthread_name_cleaner([&]() {
+                       pthread_setname_np(pthread_self(), buf);
+               });
+diff --git a/src/bees.cc b/src/bees.cc
+index aa55af0..c1cc8cb 100644
+--- a/src/bees.cc
++++ b/src/bees.cc
+@@ -160,10 +160,12 @@ BeesNote::get_name()
+       // OK try the pthread name next.
+       char buf[24];
+       memset(buf, '\0', sizeof(buf));
++#ifdef _GNU_SOURCE
+       int err = pthread_getname_np(pthread_self(), buf, sizeof(buf));
+       if (err) {
+               return string("pthread_getname_np: ") + strerror(err);
+       }
++#endif
+       buf[sizeof(buf) - 1] = '\0';
+ 
+       // thread_getname_np returns process name
+-- 
+2.24.1
+

Reply via email to