sys-block/nbd: Fix passing incompatible pointer type

Closes: https://bugs.gentoo.org/937330
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37959
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
This commit is contained in:
Brahmajit Das
2024-08-04 16:58:11 -04:00
committed by Mike Gilbert
parent e3a356162a
commit db4e970444
2 changed files with 120 additions and 0 deletions
@@ -0,0 +1,34 @@
https://github.com/NetworkBlockDevice/nbd/commit/4664b8dd3bc124c27b160720113339c1da97c2c4.patch
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>
--- 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;
+86
View File
@@ -0,0 +1,86 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit systemd
DESCRIPTION="Userland client/server for kernel network block device"
HOMEPAGE="https://nbd.sourceforge.io/"
if [[ ${PV} == 9999 ]] ; then
inherit autotools git-r3
EGIT_REPO_URI="https://github.com/NetworkBlockDevice/nbd.git"
else
SRC_URI="https://github.com/NetworkBlockDevice/nbd/releases/download/${P}/${P}.tar.xz"
SRC_URI+=" https://downloads.sourceforge.net/nbd/${P}.tar.xz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~sparc ~x86"
fi
LICENSE="GPL-2"
SLOT="0"
IUSE="debug gnutls netlink zlib"
RDEPEND="
>=dev-libs/glib-2.32.0
gnutls? ( >=net-libs/gnutls-2.12.0 )
netlink? ( >=dev-libs/libnl-3.1 )
zlib? ( sys-libs/zlib )
"
DEPEND="${RDEPEND}"
BDEPEND="
sys-devel/bison
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}/${PN}-3.25-fix-build-on-musl-gcc14.patch"
)
if [[ ${PV} == 9999 ]] ; then
BDEPEND+="
app-text/docbook-sgml-dtd:4.5
app-text/docbook-sgml-utils
dev-build/autoconf-archive
"
fi
src_prepare() {
default
if [[ ${PV} == 9999 ]] ; then
emake -C man -f mans.mk \
nbd-server.1.sh.in \
nbd-server.5.sh.in \
nbd-client.8.sh.in \
nbd-trdump.1.sh.in \
nbd-trplay.1.sh.in \
nbdtab.5.sh.in
emake -C systemd -f Makefile.am nbd@.service.sh.in
eautoreconf
fi
}
src_configure() {
# Needs Bison
unset YACC
local myeconfargs=(
--enable-lfs
# https://github.com/NetworkBlockDevice/nbd/issues/149
--disable-gznbd
$(use_enable !debug syslog)
$(use_enable debug)
$(use_with gnutls)
$(use_with netlink libnl)
)
econf "${myeconfargs[@]}"
}
src_install() {
default
systemd_dounit systemd/nbd@.service
}