summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/upstream_Fix-sort_r-selection-on-GNU-Hurd.patch34
2 files changed, 35 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..888f5bb
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+upstream_Fix-sort_r-selection-on-GNU-Hurd.patch
diff --git a/debian/patches/upstream_Fix-sort_r-selection-on-GNU-Hurd.patch b/debian/patches/upstream_Fix-sort_r-selection-on-GNU-Hurd.patch
new file mode 100644
index 0000000..47398cf
--- /dev/null
+++ b/debian/patches/upstream_Fix-sort_r-selection-on-GNU-Hurd.patch
@@ -0,0 +1,34 @@
+From 3b7ed0e67f919e49ea8b1f5387c14b762f446b45 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <toscano.pino@tiscali.it>
+Date: Mon, 3 Jul 2023 11:36:47 +0200
+Subject: [PATCH] Fix sort_r selection on GNU/Hurd
+
+The Hurd is based on the Mach microkernel, and thus __MACH__ is defined;
+since also macOS is (loosely) based on Mach, it defines __MACH__ as
+well. Because of this, the wrong variant of sort_r (i.e. the BSD one)
+is used for the Hurd, which does not work.
+
+Since on macOS __APPLE__ is defined, and __DARWIN__ helps for older
+Mac OS X, then simply drop the __MACH__ selection: the preprocessor
+check for the Linux sort_r is properly used for the Hurd (using
+__GNU__), and that variant works fine.
+---
+ src/sort_r.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sort_r.h b/src/sort_r.h
+index cfbde7f4..bdc4b2cc 100644
+--- a/src/sort_r.h
++++ b/src/sort_r.h
+@@ -19,7 +19,7 @@ void sort_r(void *base, size_t nel, size_t width,
+ void *arg);
+ */
+
+-#if (defined __APPLE__ || defined __MACH__ || defined __DARWIN__ || \
++#if (defined __APPLE__ || defined __DARWIN__ || \
+ defined __FreeBSD__ || defined __BSD__ || defined __bsdi__ || \
+ defined OpenBSD3_1 || defined OpenBSD3_9 || defined __OpenBSD__ || \
+ defined __NetBSD__ || \
+--
+2.40.1
+