From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1709191-garchives=archives.gentoo.org@lists.gentoo.org>
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 A0CB515813A
	for <garchives@archives.gentoo.org>; Tue, 14 Jan 2025 02:32:47 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E6F2DE076B;
	Tue, 14 Jan 2025 02:32:46 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(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 pigeon.gentoo.org (Postfix) with ESMTPS id C5697E076B
	for <gentoo-commits@lists.gentoo.org>; Tue, 14 Jan 2025 02:32:46 +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 C586C33BE32
	for <gentoo-commits@lists.gentoo.org>; Tue, 14 Jan 2025 02:32:45 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 2349AAEE
	for <gentoo-commits@lists.gentoo.org>; Tue, 14 Jan 2025 02:32:44 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
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" <sam@gentoo.org>
Message-ID: <1736821859.156e75fb38ab5a37f763729a7f79b89221015d9a.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/files/, sys-libs/musl/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch sys-libs/musl/musl-1.2.3-r8.ebuild sys-libs/musl/musl-1.2.3-r9.ebuild sys-libs/musl/musl-1.2.4-r2.ebuild sys-libs/musl/musl-1.2.4-r3.ebuild sys-libs/musl/musl-1.2.5-r1.ebuild sys-libs/musl/musl-1.2.5-r2.ebuild
X-VCS-Directories: sys-libs/musl/ sys-libs/musl/files/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 156e75fb38ab5a37f763729a7f79b89221015d9a
X-VCS-Branch: master
Date: Tue, 14 Jan 2025 02:32:44 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: db2f9dc5-7bf1-451a-bfdd-4497e814cbe4
X-Archives-Hash: 2613ef3b63bf916389fce5d33db93402

commit:     156e75fb38ab5a37f763729a7f79b89221015d9a
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Mon Jan 13 14:01:28 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 14 02:30:59 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=156e75fb

sys-libs/musl: reduce namespace conflicts in sched.h in _GNU_SOURCE profile

patch from upstream on IRC

Closes: https://bugs.gentoo.org/895828
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40118
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../musl-sched.h-reduce-namespace-conflicts.patch  | 58 ++++++++++++++++++++++
 .../{musl-1.2.3-r8.ebuild => musl-1.2.3-r9.ebuild} |  4 ++
 .../{musl-1.2.4-r2.ebuild => musl-1.2.4-r3.ebuild} |  1 +
 .../{musl-1.2.5-r1.ebuild => musl-1.2.5-r2.ebuild} |  1 +
 4 files changed, 64 insertions(+)

diff --git a/sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch b/sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch
new file mode 100644
index 000000000000..d2d3b9343842
--- /dev/null
+++ b/sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch
@@ -0,0 +1,58 @@
+commit 1a98576401ff604ff06a030a3644e2780b2a837d
+Author: Rich Felker <dalias@aerifal.cx>
+Date:   Mon Jan 13 08:31:02 2025 -0500
+
+    sched.h: reduce namespace conflicts in _GNU_SOURCE profile
+    
+    we have the cpuset macros call calloc/free/memset/memcmp directly so
+    that they don't depend on any further ABI surface. this is not
+    namespace-clean, but only affects the _GNU_SOURCE feature profile,
+    which is not intended to be namespace-clean. nonetheless, reports come
+    up now and then of things which are gratuitously broken, usually when
+    an application has wrapped malloc with macros.
+    
+    this patch parenthesizes the function names so that function-like
+    macros will not be expanded, and removes the unused declaration of
+    memcpy. this is not a complete solution, but it should improve things
+    for affected applications, particularly ones which are not even trying
+    to use the cpuset interfaces which got them just because g++ always
+    defines _GNU_SOURCE.
+
+diff --git a/include/sched.h b/include/sched.h
+index 204c34f5..8c3b53f0 100644
+--- a/include/sched.h
++++ b/include/sched.h
+@@ -78,11 +78,10 @@ int clone (int (*)(void *), void *, int, void *, ...);
+ int unshare(int);
+ int setns(int, int);
+ 
+-void *memcpy(void *__restrict, const void *__restrict, size_t);
+-int memcmp(const void *, const void *, size_t);
+-void *memset (void *, int, size_t);
+-void *calloc(size_t, size_t);
+-void free(void *);
++int (memcmp)(const void *, const void *, size_t);
++void *(memset)(void *, int, size_t);
++void *(calloc)(size_t, size_t);
++void (free)(void *);
+ 
+ typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
+ int __sched_cpucount(size_t, const cpu_set_t *);
+@@ -116,13 +115,13 @@ __CPU_op_func_S(XOR, ^)
+ #define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d)
+ 
+ #define CPU_COUNT_S(size,set) __sched_cpucount(size,set)
+-#define CPU_ZERO_S(size,set) memset(set,0,size)
+-#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size))
++#define CPU_ZERO_S(size,set) (memset)(set,0,size)
++#define CPU_EQUAL_S(size,set1,set2) (!(memcmp)(set1,set2,size))
+ 
+ #define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \
+ 	+ ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) )
+-#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
+-#define CPU_FREE(set) free(set)
++#define CPU_ALLOC(n) ((cpu_set_t *)(calloc)(1,CPU_ALLOC_SIZE(n)))
++#define CPU_FREE(set) (free)(set)
+ 
+ #define CPU_SETSIZE 1024
+ 

diff --git a/sys-libs/musl/musl-1.2.3-r8.ebuild b/sys-libs/musl/musl-1.2.3-r9.ebuild
similarity index 98%
rename from sys-libs/musl/musl-1.2.3-r8.ebuild
rename to sys-libs/musl/musl-1.2.3-r9.ebuild
index 1aadcaab94cf..3436d7f34687 100644
--- a/sys-libs/musl/musl-1.2.3-r8.ebuild
+++ b/sys-libs/musl/musl-1.2.3-r9.ebuild
@@ -56,6 +56,10 @@ else
 	PDEPEND="!crypt? ( sys-libs/libxcrypt[system] )"
 fi
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-sched.h-reduce-namespace-conflicts.patch
+)
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }

diff --git a/sys-libs/musl/musl-1.2.4-r2.ebuild b/sys-libs/musl/musl-1.2.4-r3.ebuild
similarity index 98%
rename from sys-libs/musl/musl-1.2.4-r2.ebuild
rename to sys-libs/musl/musl-1.2.4-r3.ebuild
index 8bfb46ffef59..3909d62c13de 100644
--- a/sys-libs/musl/musl-1.2.4-r2.ebuild
+++ b/sys-libs/musl/musl-1.2.4-r3.ebuild
@@ -51,6 +51,7 @@ fi
 PATCHES=(
 	"${FILESDIR}"/${P}-elfutils-0.190-relr.patch
 	"${FILESDIR}"/${PN}-1.2.4-arm64-crti-alignment.patch
+	"${FILESDIR}"/${PN}-sched.h-reduce-namespace-conflicts.patch
 )
 
 just_headers() {

diff --git a/sys-libs/musl/musl-1.2.5-r1.ebuild b/sys-libs/musl/musl-1.2.5-r2.ebuild
similarity index 98%
rename from sys-libs/musl/musl-1.2.5-r1.ebuild
rename to sys-libs/musl/musl-1.2.5-r2.ebuild
index 7fe02741839d..62c8bedc5e27 100644
--- a/sys-libs/musl/musl-1.2.5-r1.ebuild
+++ b/sys-libs/musl/musl-1.2.5-r2.ebuild
@@ -52,6 +52,7 @@ fi
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-1.2.4-arm64-crti-alignment.patch
+	"${FILESDIR}"/${PN}-sched.h-reduce-namespace-conflicts.patch
 )
 
 just_headers() {