void-packages/srcpkgs/xbps/patches/glibc-2.38.patch

204 lines
5.6 KiB
Diff

From 48c9879d33357254f5f405b3d5463708c9d074f9 Mon Sep 17 00:00:00 2001
From: Duncan Overbruck <mail@duncano.de>
Date: Wed, 10 Jan 2024 17:41:38 +0100
Subject: [PATCH] lib,bin: cleanup _{GNU,BSD,DEFAULT}_SOURCE, this shouldn't be
per file
---
bin/xbps-fbulk/main.c | 2 --
bin/xbps-query/search.c | 4 ----
bin/xbps-uchroot/main.c | 2 --
bin/xbps-uunshare/main.c | 1 -
configure | 2 +-
lib/cb_util.c | 4 ----
lib/external/dewey.c | 2 --
lib/external/fexec.c | 4 ----
lib/fetch/ftp.c | 5 -----
lib/fetch/http.c | 4 ----
lib/portableproplib/prop_object.c | 4 +---
lib/util.c | 8 --------
12 files changed, 2 insertions(+), 40 deletions(-)
diff --git a/bin/xbps-fbulk/main.c b/bin/xbps-fbulk/main.c
index ea298e392..93f4987a9 100644
--- a/bin/xbps-fbulk/main.c
+++ b/bin/xbps-fbulk/main.c
@@ -47,8 +47,6 @@
* Only one attempt is made to build any given package, no matter how many
* other packages depend on it.
*/
-#define _DEFAULT_SOURCE
-#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/bin/xbps-query/search.c b/bin/xbps-query/search.c
index 6724e3ef2..7f3dfe0ff 100644
--- a/bin/xbps-query/search.c
+++ b/bin/xbps-query/search.c
@@ -23,10 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef HAVE_STRCASESTR
-# define _GNU_SOURCE /* for strcasestr(3) */
-#endif
-
#include "compat.h"
#include <stdio.h>
diff --git a/bin/xbps-uchroot/main.c b/bin/xbps-uchroot/main.c
index 410afe3b7..c4685335e 100644
--- a/bin/xbps-uchroot/main.c
+++ b/bin/xbps-uchroot/main.c
@@ -32,8 +32,6 @@
* - Supports overlayfs on a temporary directory or a tmpfs mount.
* - Supports read-only bind mounts.
*/
-#define _GNU_SOURCE
-#define _XOPEN_SOURCE 700
#include <sys/types.h>
#include <sys/prctl.h>
#include <sys/fsuid.h>
diff --git a/bin/xbps-uunshare/main.c b/bin/xbps-uunshare/main.c
index ac257d383..89ee9b4e7 100644
--- a/bin/xbps-uunshare/main.c
+++ b/bin/xbps-uunshare/main.c
@@ -22,7 +22,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/fsuid.h>
diff --git a/configure b/configure
index c7d78bf16..2b54b90ef 100755
--- a/configure
+++ b/configure
@@ -195,7 +195,7 @@ echo "CC = $CC" >>$CONFIG_MK
echo "CFLAGS = -O2" >>$CONFIG_MK
echo "LDFLAGS = -L\$(TOPDIR)/lib" >>$CONFIG_MK
-echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
+echo "CPPFLAGS = -D_DEFAULT_SOURCE -D_GNU_SOURCE -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK
echo "CPPFLAGS += -DXBPS_SYSDEFCONF_PATH=\\\"${SHAREDIR}/xbps.d\\\"" >>$CONFIG_MK
echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK
diff --git a/lib/cb_util.c b/lib/cb_util.c
index 1aa0f073e..35fbaa77e 100644
--- a/lib/cb_util.c
+++ b/lib/cb_util.c
@@ -23,10 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef HAVE_VASPRINTF
-# define _GNU_SOURCE /* for vasprintf(3) */
-#endif
-
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
diff --git a/lib/external/dewey.c b/lib/external/dewey.c
index 9ee9901b8..fb6f0d1e7 100644
--- a/lib/external/dewey.c
+++ b/lib/external/dewey.c
@@ -30,9 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
-#define _BSD_SOURCE
#include <string.h>
-#undef _BSD_SOURCE
#include <strings.h>
#include <ctype.h>
diff --git a/lib/external/fexec.c b/lib/external/fexec.c
index 11c40120a..57e1de745 100644
--- a/lib/external/fexec.c
+++ b/lib/external/fexec.c
@@ -27,8 +27,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define _BSD_SOURCE /* for vfork and chroot */
-#define _DEFAULT_SOURCE /* glibc>=2.20 */
#include <sys/types.h>
#include <unistd.h>
@@ -38,8 +36,6 @@
#include <stdlib.h>
#include <string.h>
-#undef _DEFAULT_SOURCE
-#undef _BSD_SOURCE
#include "xbps_api_impl.h"
static int
diff --git a/lib/fetch/ftp.c b/lib/fetch/ftp.c
index 28296a009..9986a57e2 100644
--- a/lib/fetch/ftp.c
+++ b/lib/fetch/ftp.c
@@ -57,11 +57,6 @@
*
*/
-#ifdef __linux__
-/* Keep this down to Linux, it can create surprises else where. */
-#define _GNU_SOURCE
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/lib/fetch/http.c b/lib/fetch/http.c
index 0165de32c..e0832865c 100644
--- a/lib/fetch/http.c
+++ b/lib/fetch/http.c
@@ -62,10 +62,6 @@
* SUCH DAMAGE.
*/
-#if defined(__linux__)
-#define _GNU_SOURCE
-#endif
-
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/lib/portableproplib/prop_object.c b/lib/portableproplib/prop_object.c
index 58dc7da3b..6befb25f2 100644
--- a/lib/portableproplib/prop_object.c
+++ b/lib/portableproplib/prop_object.c
@@ -38,9 +38,7 @@
static pthread_mutex_t _prop_refcnt_mtx = PTHREAD_MUTEX_INITIALIZER;
#endif /* _PROP_NEED_REFCNT_MTX */
-#define __USE_MISC /* MAP_ANON on glibc */
-# include <sys/mman.h>
-#undef __USE_MISC
+#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/lib/util.c b/lib/util.c
index 794c37485..659a37caf 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -23,14 +23,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef HAVE_VASPRINTF
-# define _GNU_SOURCE /* for vasprintf(3) */
-#endif
-
-#if defined(HAVE_STRLCAT) || defined(HAVE_STRLCPY)
-# define _BSD_SOURCE
-#endif
-
#include "compat.h"
#include <sys/utsname.h>