]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
mpd: Fix build against glibc >= 2.43
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 26 Jan 2026 17:49:46 +0000 (17:49 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 28 Jan 2026 11:29:23 +0000 (11:29 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/mpd
src/patches/mpd-0.24.5-openat2.patch [new file with mode: 0644]

diff --git a/lfs/mpd b/lfs/mpd
index f78152623bf5751aa84c8465351e4707deefd86b..a5a3cd3577219cda419ccfaf6178561cafffd32b 100644 (file)
--- a/lfs/mpd
+++ b/lfs/mpd
@@ -34,7 +34,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/${THISAPP}
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = mpd
-PAK_VER    = 48
+PAK_VER    = 49
 # SUP_ARCH   = aarch64 x86_64
 
 DEPS       = alsa avahi faad2 ffmpeg flac lame libmad libshout libogg libid3tag libvorbis opus soxr fmt
@@ -82,6 +82,7 @@ $(subst %,%_BLAKE2,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mpd-0.24.5-openat2.patch
        $(UPDATE_AUTOMAKE)
        cd $(DIR_APP) && meson setup \
                                --prefix=/usr \
diff --git a/src/patches/mpd-0.24.5-openat2.patch b/src/patches/mpd-0.24.5-openat2.patch
new file mode 100644 (file)
index 0000000..2963d7d
--- /dev/null
@@ -0,0 +1,60 @@
+From 8caeedac3ed17491cd77240211ed13be80072a15 Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann@gmail.com>
+Date: Mon, 26 Jan 2026 14:18:53 +0100
+Subject: [PATCH] system/linux: detect native openat2() support at configure
+ time
+
+The Linux man-pages notes about openat2(): "glibc provides no wrapper
+for openat2(), necessitating the use of syscall(2)"
+
+.. but glibc 2.43 finally added a wrapper which caused a conflict with
+our existing definition.
+
+Closes https://github.com/MusicPlayerDaemon/MPD/issues/2417
+---
+ src/system/linux/meson.build |  6 +++++-
+ src/system/linux/openat2.h   | 11 ++++++++++-
+
+diff --git a/src/system/linux/meson.build b/src/system/linux/meson.build
+index 36a98f2127..4a0d6267ad 100644
+--- a/src/system/linux/meson.build
++++ b/src/system/linux/meson.build
+@@ -1,7 +1,11 @@
+ system_linux_features = configuration_data()
+ if host_machine.system() == 'linux'
+-  system_linux_features.set('HAVE_OPENAT2', compiler.has_header('linux/openat2.h'))
++  have_native_openat2 = compiler.has_header_symbol('fcntl.h', 'openat2')
++  # openat2() support was added to glibc 2.43
++  system_linux_features.set('HAVE_NATIVE_OPENAT2', have_native_openat2)
++  # if not provided by the C library, we roll our own using syscall()
++  system_linux_features.set('HAVE_OPENAT2', have_native_openat2 or compiler.has_header('linux/openat2.h'))
+ endif
+ configure_file(output: 'Features.h', configuration: system_linux_features)
+diff --git a/src/system/linux/openat2.h b/src/system/linux/openat2.h
+index fdf3820983..807df97cb3 100644
+--- a/src/system/linux/openat2.h
++++ b/src/system/linux/openat2.h
+@@ -4,7 +4,14 @@
+ #pragma once
+-#include <fcntl.h> // for O_*
++#include "system/linux/Features.h" // for HAVE_NATIVE_OPENAT2
++
++#include <fcntl.h>
++
++#ifndef HAVE_NATIVE_OPENAT2
++/* if the C library does not provide an openat2() wrappper, we roll
++   our own */
++
+ #include <linux/openat2.h> // for RESOLVE_*
+ #include <sys/syscall.h>
+ #include <unistd.h>
+@@ -15,3 +22,5 @@ openat2(int dirfd, const char *pathname,
+ {
+       return syscall(__NR_openat2, dirfd, pathname, how, size);
+ }
++
++#endif // !HAVE_NATIVE_OPENAT2