community/nbd: upgrade to 3.26.1

This commit is contained in:
mio 2024-09-07 21:06:10 +00:00 committed by Natanael Copa
parent 2fbb25dfab
commit e5475377d8
4 changed files with 73 additions and 94 deletions

View File

@ -1,8 +1,8 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=nbd
pkgver=3.24
pkgrel=1
pkgver=3.26.1
pkgrel=0
pkgdesc="Tools for network block devices"
url="https://nbd.sourceforge.io/"
arch="all"
@ -15,12 +15,13 @@ makedepends="
linux-headers
zlib-dev
"
subpackages="$pkgname-doc $pkgname-client $pkgname-openrc"
# Disable -doc, requires docbook2man
subpackages="$pkgname-client $pkgname-openrc"
source="https://github.com/NetworkBlockDevice/nbd/releases/download/nbd-$pkgver/nbd-$pkgver.tar.xz
glib-2.76.patch
nbd-server.initd
gcc14-nbd-client-fix-build.patch
skip-manpages-systemd.patch
"
options="!check" # logs very spammy (to infinite size), FIXME
# secfixes:
# 3.24-r0:
@ -36,8 +37,7 @@ build() {
--mandir=/usr/share/man \
--localstatedir=/var \
--enable-lfs \
--enable-syslog \
--enable-gznbd
--enable-syslog
make
}
@ -58,7 +58,8 @@ client() {
}
sha512sums="
b542733ca8bdfb6883591acd5cc82fd8fa64fed7ca85b01a961e0ad69b9655750e5317df9ec510b4147cc8b0b5cdfa0b43da53dd06c42863553555d710a3c85d nbd-3.24.tar.xz
c78efa300c5dcef405ab29b633383139e51288a142f7c2b71b266527c6668f587275f43f175861c587c9309a2267f57f99be62359b10f863c2fab1862c3a2416 glib-2.76.patch
ceb1df5b4f28805f3aeccd5a0c8bd7c04e1eac461ef4d93f595e2b19b04039acecd587be88c457a9d9187b2366f57faa38757fb8fd15ab0ec53634b841e40bf0 nbd-3.26.1.tar.xz
7012adb1d822454b29d1c75cdeaab9dfa2bf0e41c058509428227953b1e555b76c1802a78e66d8fa3fc2ada932cfe265e80c90fa9dbddd544c81b1411c8ab4b4 nbd-server.initd
eebb499e6974ef1abf6fdc34bed4ec3ec52409410390abaabd9938380a9c60938755bdb6feb1b6af78316474f0187120bd271c032f53151919b045caaeb1f850 gcc14-nbd-client-fix-build.patch
20a69c0bf247b232a40a1d76f13addd8887b4cb38763ed64ff12b403ca1a882768a55b2cca1d0b200559537a95add319029f22ce3f5960d15407650ac393061b skip-manpages-systemd.patch
"

View File

@ -0,0 +1,41 @@
Source: https://github.com/NetworkBlockDevice/nbd/commit/4664b8dd3bc124c27b160720113339c1da97c2c4
--
From 4664b8dd3bc124c27b160720113339c1da97c2c4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 20 May 2024 17:50:51 -0700
Subject: [PATCH] nbd-client: Fix build on musl + gcc14
GCC-14 has promoted incompatible-pointer-types warning into error which is
now flagged especially with when building on musl
Fixes following error
| ../nbd-3.26.1/nbd-client.c: In function 'openunix':
| ../nbd-3.26.1/nbd-client.c:345:27: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
| 345 | if (connect(sock, &un_addr, sizeof(un_addr)) == -1) {
| | ^~~~~~~~
| | |
| | struct sockaddr_un *
| In file included from ../nbd-3.26.1/nbd-client.c:25:
| /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/nbd/3.26.1/recipe-sysroot/usr/include/sys/socket.h:386:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
| 386 | int connect (int, const struct sockaddr *, socklen_t);
| | ^~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
nbd-client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nbd-client.c b/nbd-client.c
index f4e120f8..bc79bdf3 100644
--- a/nbd-client.c
+++ b/nbd-client.c
@@ -342,7 +342,7 @@ int openunix(const char *path) {
return -1;
};
- if (connect(sock, &un_addr, sizeof(un_addr)) == -1) {
+ if (connect(sock, (struct sockaddr*)&un_addr, sizeof(un_addr)) == -1) {
err_nonfatal("CONNECT failed");
close(sock);
return -1;

View File

@ -1,85 +0,0 @@
Patch-Source: https://github.com/NetworkBlockDevice/nbd/commit/3cb679f4a97e1a54a7285ee1f22e2888c9d3b900
--
From 3cb679f4a97e1a54a7285ee1f22e2888c9d3b900 Mon Sep 17 00:00:00 2001
From: Wouter Verhelst <w@uter.be>
Date: Thu, 27 Apr 2023 15:35:40 +0200
Subject: [PATCH] nbd-server: do not straddle uses of GThreadPool across a
fork()
We created the thread pool at the main initialization, before forking
off a child. This used to work just fine, but as of GLib 2.76, this no
longer works due to changes internal to the implementation of
GThreadPool.
Since we don't need to use the thread pool before the fork() call
anyway, stop trying to do so and avoid the problem altogether.
Closes: gh-146
Signed-off-by: Wouter Verhelst <w@uter.be>
---
nbd-server.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/nbd-server.c b/nbd-server.c
index fe97ca7..473fb71 100644
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -200,7 +200,7 @@ char default_authname[] = SYSCONFDIR "/nbd-server/allow"; /**< default name of a
#include <nbdsrv.h>
/* Our thread pool */
-GThreadPool *tpool;
+GThreadPool *tpool = NULL;
/* A work package for the thread pool functions */
struct work_package {
@@ -2895,7 +2895,6 @@ static int mainloop_threaded(CLIENT* client) {
req->type = ntohl(req->type);
req->len = ntohl(req->len);
-
if(req->magic != htonl(NBD_REQUEST_MAGIC))
err("Protocol error: not enough magic.");
@@ -2934,9 +2933,7 @@ void destroy_pid_t(gpointer data) {
g_free(data);
}
-static pid_t
-spawn_child(int* socket)
-{
+static pid_t spawn_child(int* socket) {
pid_t pid;
sigset_t newset;
sigset_t oldset;
@@ -3019,6 +3016,7 @@ handle_modern_connection(GArray *const servers, const int sock, struct generic_c
}
/* Child just continues. */
}
+ tpool = g_thread_pool_new(handle_request, NULL, genconf->threads, FALSE, NULL);
sock_flags_old = fcntl(net, F_GETFL, 0);
if (sock_flags_old == -1) {
@@ -3151,11 +3149,11 @@ static int append_new_servers(GArray *const servers, struct generic_conf *gencon
int retval = -1;
new_servers = parse_cfile(config_file_pos, genconf, true, gerror);
- g_thread_pool_set_max_threads(tpool, genconf->threads, NULL);
- if (!new_servers)
+ if(tpool) g_thread_pool_set_max_threads(tpool, genconf->threads, NULL);
+ if(!new_servers)
goto out;
- for (i = 0; i < new_servers->len; ++i) {
+ for(i = 0; i < new_servers->len; ++i) {
SERVER *new_server = g_array_index(new_servers, SERVER*, i);
if (new_server->servename
@@ -3704,7 +3702,6 @@ int main(int argc, char *argv[]) {
#if HAVE_OLD_GLIB
g_thread_init(NULL);
#endif
- tpool = g_thread_pool_new(handle_request, NULL, genconf.threads, FALSE, NULL);
setup_servers(servers, genconf.modernaddr, genconf.modernport,
genconf.unixsock, genconf.flags);

View File

@ -0,0 +1,22 @@
--- 3.26.1-origin/Makefile.in
+++ 3.26.1/Makefile.in
@@ -492,7 +492,7 @@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I support
-SUBDIRS = . man doc tests systemd gznbd
+SUBDIRS = . man doc tests gznbd
noinst_LTLIBRARIES = libnbdsrv.la libcliserv.la libnbdclt.la
libcliserv_la_SOURCES = cliserv.h cliserv.c
libcliserv_la_CFLAGS = @CFLAGS@
--- 3.26.1-origin/configure
+++ 3.26.1/configure
@@ -16775,8 +16775,6 @@
elif test "x$DB2M" != "x"
then :
enable_manpages=yes
-else $as_nop
- as_fn_error $? "don't know what to do here" "$LINENO" 5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build manpages" >&5
printf %s "checking whether to build manpages... " >&6; }