From 3c8da751e65c1afe086abc6149f0cbe21263e3fd Mon Sep 17 00:00:00 2001 From: ghpzin Date: Tue, 16 Sep 2025 21:35:03 +0300 Subject: [PATCH] dmraid: fix build with gcc15 - add rebased patch from alpine: https://gitlab.alpinelinux.org/alpine/aports/-/raw/dc5b3135517ede55f5e3530e538ca75048d26565/main/dmraid/008-gcc15.patch (does not apply with `fetchpatch` even with `stripLen` and `extraPrefix`) Fixes build failure with gcc15: ``` activate/activate.c:893:34: error: passing argument 3 of 'do_device' from incompatible pointer type [-Wincompatible-pointer-types] 893 | return do_device(lc, rs, dm_register_for_event); | ^~~~~~~~~~~~~~~~~~~~~ | | | int (*)(char *, char *) activate/activate.c:869:62: note: expected 'int (*)(void)' but argument is of type 'int (*)(char *, char *)' 869 | do_device(struct lib_context *lc, struct raid_set *rs, int (*f) ()) | ~~~~~~^~~~~ activate/activate.c:850:1: note: 'dm_register_for_event' declared here 850 | dm_register_for_event(char *dev_name, char *lib_name) | ^~~~~~~~~~~~~~~~~~~~~ misc/file.c:66:17: error: initialization of 'ssize_t (*)(void)' {aka 'long int (*)(void)'} from incompatible pointer type 'ssize_t (*)(int, void *, size_t)' {aka 'long int (*)(int, void *, long unsigned int)'} [-Wincompatible-pointer-types] 66 | read, "read"}, { | ^~~~ misc/file.c:67:9: error: initialization of 'ssize_t (*)(void)' {aka 'long int (*)(void)'} from incompatible pointer type 'ssize_t (*)(int, const void *, size_t)' {aka 'long int (*)(int, const void *, long unsigned int)'} [-Wincompatible-pointer-types] 67 | write, "writ"},}, *rw = rw_spec + ((flags & O_WRONLY) ? 1 : 0); | ^~~~~ misc/file.c:67:9: note: (near initialization for 'rw_spec[1].func') ``` --- pkgs/os-specific/linux/dmraid/default.nix | 4 +++ .../dmraid/dmraid-fix-build-with-gcc15.patch | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 pkgs/os-specific/linux/dmraid/dmraid-fix-build-with-gcc15.patch diff --git a/pkgs/os-specific/linux/dmraid/default.nix b/pkgs/os-specific/linux/dmraid/default.nix index 18874fa3b7a2..4ec7581c639b 100644 --- a/pkgs/os-specific/linux/dmraid/default.nix +++ b/pkgs/os-specific/linux/dmraid/default.nix @@ -18,6 +18,10 @@ stdenv.mkDerivation rec { patches = [ ./hardening-format.patch ./fix-dmevent_tool.patch + + # Fix build with gcc15, based on + # https://gitlab.alpinelinux.org/alpine/aports/-/raw/dc5b3135517ede55f5e3530e538ca75048d26565/main/dmraid/008-gcc15.patch + ./dmraid-fix-build-with-gcc15.patch ] ++ lib.optionals stdenv.hostPlatform.isMusl [ (fetchpatch { diff --git a/pkgs/os-specific/linux/dmraid/dmraid-fix-build-with-gcc15.patch b/pkgs/os-specific/linux/dmraid/dmraid-fix-build-with-gcc15.patch new file mode 100644 index 000000000000..6ebbb51a6b9f --- /dev/null +++ b/pkgs/os-specific/linux/dmraid/dmraid-fix-build-with-gcc15.patch @@ -0,0 +1,33 @@ +diff --git a/1.0.0.rc16/lib/activate/activate.c b/1.0.0.rc16/lib/activate/activate.c +index 1d71ea8c0a..0a4ec6afa1 100644 +--- a/1.0.0.rc16/lib/activate/activate.c ++++ b/1.0.0.rc16/lib/activate/activate.c +@@ -866,7 +866,7 @@ + + #define LIB_NAME_LENGTH 255 + static int +-do_device(struct lib_context *lc, struct raid_set *rs, int (*f) ()) ++do_device(struct lib_context *lc, struct raid_set *rs, int (*f)(char *, char *)) + { + int ret = 0; + char lib_name[LIB_NAME_LENGTH]; +diff --git a/1.0.0.rc16/lib/misc/file.c b/1.0.0.rc16/lib/misc/file.c +index fe74d5c9c2..c060b6e712 100644 +--- a/1.0.0.rc16/lib/misc/file.c ++++ b/1.0.0.rc16/lib/misc/file.c +@@ -59,12 +59,12 @@ + int fd, ret = 0; + loff_t o; + struct { +- ssize_t(*func) (); ++ ssize_t(*func)(int, void *, size_t); + const char *what; + } rw_spec[] = { + { + read, "read"}, { +- write, "writ"},}, *rw = rw_spec + ((flags & O_WRONLY) ? 1 : 0); ++ (ssize_t(*)(int, void *, size_t))write, "writ"},}, *rw = rw_spec + ((flags & O_WRONLY) ? 1 : 0); + + if ((fd = open(path, flags, lc->mode)) == -1) + LOG_ERR(lc, 0, "opening \"%s\"", path); +