From nobody Mon Jul 17 18:55:52 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R4WWD4jpdz4mwKS; Mon, 17 Jul 2023 18:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R4WWD3qdVz3nS7; Mon, 17 Jul 2023 18:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689620152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EUO9rz5vaVyS4vi+utPCVbjox6INNrHId1oM3tmold0=; b=tI0QJNuXqqAkDFMdal4DjR6qh0LNZ2ziWJeJM+Op3wUVM9ygD5ID/pkMPDc1KNC5itz8WH qZZzVOIL3C7t2cyzYYtHWGs+qbLePgcZfgeDbKaA8dzJ+WnI56YBeMAcQ0kioFnSSv9VQF kj/ChCz3qcny0+4/VQ4qOhyT/OtTWnPDJ/dObWsQJzzOhoaTOwuDpt5ua08R0sTFbdFQot abqxqv+gpSJ+bqf6JqB973mRhNZd43T+G3bHy+ZJoPriNkU2w2Kb30f8hQWGC2bui5VWBs bynerzHdzQMReidh4lml9kYeNUxQM3chx47LxkL7riEKl/5uvnU41bzMcIvJFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689620152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EUO9rz5vaVyS4vi+utPCVbjox6INNrHId1oM3tmold0=; b=siFjixiDAJ87VCMyiO4z4f+ISxnIR+qiP7xlzbgqX0Ldu6pdR77y3wjYut0CTsye7UBK6K OlWeeG5t6LoCnZDjda5f/UnQXFAuEkUDRMLKkKu1Nz9cCY5eV4QUJLSuQPLe4GB4QPDhRH PA4y3J5ixHrBgc8iDw7UuycVNf84wBEQApYs7ap12qiWTiPZvz8Qa1CJVRVxuaBiD3XCuC 1liDrSWwaytdVoe4tsNP+M7xVxBojc0UYg8zOt0joXI9XK7j5QIL7w8opXJXoRbzP5EjYU tBBZRj44qR4z1Czc1dtkk/iXlHHAcCaLwtbKR9FqSndoV5qWs7nqB0DILReMLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689620152; a=rsa-sha256; cv=none; b=M7ni8b+GZgk5546WtUNGo0Z5eSh4HVgAgBm235F8maQvtZGzVWXs+NI2fWPo4nqiJNAOOF oe6psutU8kFx+p7QSWygOqvDvpj/rJ/WfQrwQbIRxK5MwuJX+Ln+TDs6k2JTzwv4oeKIId WF4WV1MJR3vKn+KBY4g6XV1XuKbxoR/WASctsR1dthqEg+DZxJs04gys9WZgNgKDrDNQz0 HSIXCT7BOQCCIP8lFUbdTAit/JajypBe60zkJ/GskSiWHij/XMY/FtJPPboihDOHUNDVEq sY907DzODbjIYeGb7n8Sh4EvHf54VjPPmNiyOD00GgSRl+pXXz0dSdENYdHVSQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R4WWD2vPWzZNZ; Mon, 17 Jul 2023 18:55:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36HItq3Z095678; Mon, 17 Jul 2023 18:55:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36HItq8p095677; Mon, 17 Jul 2023 18:55:52 GMT (envelope-from git) Date: Mon, 17 Jul 2023 18:55:52 GMT Message-Id: <202307171855.36HItq8p095677@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Tijl Coosemans Subject: git: fb889ca82944 - main - devel/gettext-runtime: Fix crash triggered by libgpg-error List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tijl X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb889ca82944e04d4b3dfa2a13c51456bbde0094 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tijl: URL: https://cgit.FreeBSD.org/ports/commit/?id=fb889ca82944e04d4b3dfa2a13c51456bbde0094 commit fb889ca82944e04d4b3dfa2a13c51456bbde0094 Author: Tijl Coosemans AuthorDate: 2023-07-17 13:06:02 +0000 Commit: Tijl Coosemans CommitDate: 2023-07-17 18:53:17 +0000 devel/gettext-runtime: Fix crash triggered by libgpg-error Libgpg-error has an initialisation function with __attribute__((constructor)) that calls a libintl function that calls pthread_rwlock_wrlock that segfaults if libpthread wasn't initialised yet. This can happen because libintl doesn't link to libpthread to avoid the overhead for non-threaded programs. To fix this, add an initialisation function to libintl that triggers initialisation of libpthread. RTLD_NOLOAD suggested by kib. dlopen was fixed to work during initialisation in https://cgit.FreeBSD.org/src/commit/?id=1005d3d05362 PR: 272472, 272517 --- Mk/Uses/gettext-runtime.mk | 5 +++-- devel/gettext-runtime/Makefile | 2 +- devel/gettext-runtime/files/patch-intl_osdep.c | 28 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Mk/Uses/gettext-runtime.mk b/Mk/Uses/gettext-runtime.mk index 374a19b45ec4..1d0f0b8900b9 100644 --- a/Mk/Uses/gettext-runtime.mk +++ b/Mk/Uses/gettext-runtime.mk @@ -14,13 +14,14 @@ gettext-runtime_ARGS= lib . endif . if ${gettext-runtime_ARGS:Mlib} +BUILD_DEPENDS+= gettext-runtime>=0.22_1:devel/gettext-runtime LIB_DEPENDS+= libintl.so:devel/gettext-runtime . endif . if ${gettext-runtime_ARGS:Mbuild} -BUILD_DEPENDS+= gettext:devel/gettext-runtime +BUILD_DEPENDS+= gettext-runtime>=0.22_1:devel/gettext-runtime . endif . if ${gettext-runtime_ARGS:Mrun} -RUN_DEPENDS+= gettext:devel/gettext-runtime +RUN_DEPENDS+= gettext-runtime>=0.22_1:devel/gettext-runtime . endif .endif diff --git a/devel/gettext-runtime/Makefile b/devel/gettext-runtime/Makefile index 618340e867f9..1e57b4fb24d7 100644 --- a/devel/gettext-runtime/Makefile +++ b/devel/gettext-runtime/Makefile @@ -3,7 +3,7 @@ # discretion. PORTNAME= gettext-runtime -PORTREVISION= 0 +PORTREVISION= 1 COMMENT= GNU gettext runtime libraries and programs WWW= https://www.gnu.org/software/gettext/ diff --git a/devel/gettext-runtime/files/patch-intl_osdep.c b/devel/gettext-runtime/files/patch-intl_osdep.c new file mode 100644 index 000000000000..1f1825303b65 --- /dev/null +++ b/devel/gettext-runtime/files/patch-intl_osdep.c @@ -0,0 +1,28 @@ +--- intl/osdep.c.orig 2019-05-11 11:29:32 UTC ++++ intl/osdep.c +@@ -18,6 +18,25 @@ + # include "intl-exports.c" + #elif defined __EMX__ && !defined __KLIBC__ + # include "os2compat.c" ++#elif defined __FreeBSD__ ++#include ++#include ++#include ++#include ++static __attribute__((constructor)) void ++libintl_init (void) ++{ ++#if __FreeBSD_version >= 1400094 ++ /* We don't link with libpthread in order to avoid the overhead for ++ non-threaded programs. Instead we dlopen it with RTLD_NOLOAD here ++ to ensure it is initialised when present. */ ++ (void) dlopen ("libpthread.so", RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD); ++#else ++ /* For older versions this hack also triggers libpthread ++ initialisation. */ ++ (void) pthread_self (); ++#endif ++} + #else + /* Avoid AIX compiler warning. */ + typedef int dummy;