From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (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) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B38431580FD for ; Wed, 25 Dec 2024 10:01:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 574F6E0636; Wed, 25 Dec 2024 10:01:49 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9BD8BE0636 for ; Wed, 25 Dec 2024 10:01:48 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1A281335DCC for ; Wed, 25 Dec 2024 10:01:47 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 722C817C2 for ; Wed, 25 Dec 2024 10:01:45 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1735120882.f40c02ae8c70eca848890d38010b2776f856bb1a.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/glibc/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-libs/glibc/glibc-2.40-r7.ebuild sys-libs/glibc/glibc-9999.ebuild X-VCS-Directories: sys-libs/glibc/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: f40c02ae8c70eca848890d38010b2776f856bb1a X-VCS-Branch: master Date: Wed, 25 Dec 2024 10:01:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 80c7f0a5-141a-4f35-9892-1a4209aad9d9 X-Archives-Hash: 958f914f5adbdccd8503e76b0e3f8837 commit: f40c02ae8c70eca848890d38010b2776f856bb1a Author: Sam James gentoo org> AuthorDate: Mon Dec 16 19:44:16 2024 +0000 Commit: Sam James gentoo org> CommitDate: Wed Dec 25 10:01:22 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f40c02ae sys-libs/glibc: run fixincludes in pkg_postinst We enabled fixincludes for a window between GCC 13 and whatever the just released version of glibc was at the time to cover Float128 changes. We then turned it off again when it was (mostly) no longer needed. (Though arguably it was/still is needed for some upgrade paths or combinations and maybe we should reconsider that given we now have a proper solution here to "defanging" fixincludes (as it turns out we were kind of using it wrong, see bug #30701)). Anyway, for any glibc installed during that window, a fixincludes'd pthread.h would've been installed to the include-fixed directory, which then becomes a cached stale copy when the rest of glibc changes like: ``` --- pthread.h-fixincludes 2024-12-12 06:49:06.918089635 +0000 +++ /usr/include/pthread.h 2024-12-06 16:49:09.306028087 +0000 [...] @@ -232,7 +223,7 @@ the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS ``` because the guards no longer match up with the rest of glibc. The fix is for us to refresh fixincludes using `mkheaders` (if available) which we weren't installing until recently (7d99be77433bf10fb0ce6fc99c7b40de700ed650) in pkg_postinst for sys-libs/glibc. We will likely need to add similar logic into linux-headers at least too. I am considering adding such an update to gcc-config too. Note that we also have to cover the case where mkheaders isn't available *but* a cached broken pthread.h exists, so if mkheaders doesn't exist, but pthread.h does in include-fixed, we move that away to .bak. Bug: https://gcc.gnu.org/PR20166 Bug: https://gcc.gnu.org/PR94089 Bug: https://gcc.gnu.org/PR107059 Bug: https://gcc.gnu.org/PR118009 Bug: https://bugs.gentoo.org/30701 Bug: https://bugs.gentoo.org/933282 Tested-by: Matt Jolly gentoo.org> Signed-off-by: Sam James gentoo.org> sys-libs/glibc/glibc-2.40-r7.ebuild | 23 +++++++++++++++++++++++ sys-libs/glibc/glibc-9999.ebuild | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/sys-libs/glibc/glibc-2.40-r7.ebuild b/sys-libs/glibc/glibc-2.40-r7.ebuild index 4b56270760cc..c24d663d40e0 100644 --- a/sys-libs/glibc/glibc-2.40-r7.ebuild +++ b/sys-libs/glibc/glibc-2.40-r7.ebuild @@ -1720,6 +1720,29 @@ pkg_postinst() { use loong && glibc_refresh_ldconfig use compile-locales || run_locale_gen "${EROOT}/" + + # If fixincludes was/is active for a particular GCC slot, we + # must refresh it. See bug #933282 and GCC's documentation: + # https://gcc.gnu.org/onlinedocs/gcc/Fixed-Headers.html + # + # TODO: Could this be done for non-cross? Some care would be needed + # to pass the right arguments. + while IFS= read -r -d $'\0' slot ; do + local mkheaders_path="${BROOT}"/usr/libexec/gcc/${CBUILD}/${slot##*/}/install-tools/mkheaders + local pthread_h="${BROOT}"/usr/lib/gcc/${CBUILD}/${slot##*/}/include-fixed/pthread.h + if [[ -x ${mkheaders_path} ]] ; then + ebegin "Refreshing fixincludes for ${CBUILD} with gcc-${slot##*/}" + ${mkheaders_path} -v + eend $? + elif [[ -f ${pthread_h} ]] ; then + # fixincludes might have been enabled in the past for this + # GCC slot but not since we fixed toolchain.eclass to install + # mkheaders, so we need to manually delete pthread.h at least. + ebegin "Deleting stale fixincludes'd pthread.h for ${CBUILD} with gcc-${slot##*/}" + mv -v "${pthread_h}" "${pthread_h}.bak" + eend $? + fi + done < <(find "${BROOT}"/usr/libexec/gcc/${CBUILD}/ -mindepth 1 -maxdepth 1 -type d -print0) fi upgrade_warning diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild index 50730ce83294..ceafddea0f5b 100644 --- a/sys-libs/glibc/glibc-9999.ebuild +++ b/sys-libs/glibc/glibc-9999.ebuild @@ -1731,6 +1731,29 @@ pkg_postinst() { use loong && glibc_refresh_ldconfig use compile-locales || run_locale_gen "${EROOT}/" + + # If fixincludes was/is active for a particular GCC slot, we + # must refresh it. See bug #933282 and GCC's documentation: + # https://gcc.gnu.org/onlinedocs/gcc/Fixed-Headers.html + # + # TODO: Could this be done for non-cross? Some care would be needed + # to pass the right arguments. + while IFS= read -r -d $'\0' slot ; do + local mkheaders_path="${BROOT}"/usr/libexec/gcc/${CBUILD}/${slot##*/}/install-tools/mkheaders + local pthread_h="${BROOT}"/usr/lib/gcc/${CBUILD}/${slot##*/}/include-fixed/pthread.h + if [[ -x ${mkheaders_path} ]] ; then + ebegin "Refreshing fixincludes for ${CBUILD} with gcc-${slot##*/}" + ${mkheaders_path} -v + eend $? + elif [[ -f ${pthread_h} ]] ; then + # fixincludes might have been enabled in the past for this + # GCC slot but not since we fixed toolchain.eclass to install + # mkheaders, so we need to manually delete pthread.h at least. + ebegin "Deleting stale fixincludes'd pthread.h for ${CBUILD} with gcc-${slot##*/}" + mv -v "${pthread_h}" "${pthread_h}.bak" + eend $? + fi + done < <(find "${BROOT}"/usr/libexec/gcc/${CBUILD}/ -mindepth 1 -maxdepth 1 -type d -print0) fi upgrade_warning