commit:     c5f3e3050f95d470776c9b50ac05829c75970630
Author:     Ian Jordan <immoloism <AT> gmail <DOT> com>
AuthorDate: Thu Feb  5 10:44:56 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 11 04:54:44 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5f3e305

net-misc/socat: musl fix

Based on user feedback and need this patch from Bobby is suitable
to cherrypicked while we wait for upstream to merge.

Closes: https://bugs.gentoo.org/968110
Thanks-to: Bobby Bingham <koorogi <AT> koorogi.info>
Signed-off-by: Ian Jordan <immoloism <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45646
Closes: https://github.com/gentoo/gentoo/pull/45646
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-misc/socat/files/socat-1.8.1.0-musl-fix.patch | 19 +++++++
 net-misc/socat/socat-1.8.1.0-r1.ebuild            | 67 +++++++++++++++++++++++
 2 files changed, 86 insertions(+)

diff --git a/net-misc/socat/files/socat-1.8.1.0-musl-fix.patch 
b/net-misc/socat/files/socat-1.8.1.0-musl-fix.patch
new file mode 100644
index 000000000000..f5178c45bc16
--- /dev/null
+++ b/net-misc/socat/files/socat-1.8.1.0-musl-fix.patch
@@ -0,0 +1,19 @@
+From https://bugs.gentoo.org/968110
+From: Bobby Bingham <[email protected]>
+Date: Sun, 28 Dec 2025 11:03:28 -0600
+Subject: [PATCH] don't assume order of fields in struct msghdr
+
+Fixes compilation on musl.
+--- a/xio-netlink.c
++++ b/xio-netlink.c
+@@ -30,7 +30,7 @@ int xio_netlink_mtu(
+       struct nlmsghdr buf[8192/sizeof(struct nlmsghdr)];
+       struct iovec iov = { buf, sizeof(buf) };
+       struct sockaddr_nl sa;
+-      struct msghdr rtmsg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
++      struct msghdr rtmsg = { .msg_name = &sa, .msg_namelen = sizeof(sa), 
.msg_iov = &iov, .msg_iovlen = 1 };
+       struct nlmsghdr *nh;
+ 
+       Info2("Setting interface %d MTU to %u using netlink", interface_index, 
mtu);
+-- 
+2.52.0

diff --git a/net-misc/socat/socat-1.8.1.0-r1.ebuild 
b/net-misc/socat/socat-1.8.1.0-r1.ebuild
new file mode 100644
index 000000000000..768f8541de86
--- /dev/null
+++ b/net-misc/socat/socat-1.8.1.0-r1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo flag-o-matic toolchain-funcs
+
+MY_P=${P/_beta/-b}
+DESCRIPTION="Multipurpose relay (SOcket CAT)"
+HOMEPAGE="http://www.dest-unreach.org/socat/ https://repo.or.cz/socat.git";
+SRC_URI="http://www.dest-unreach.org/socat/download/${MY_P}.tar.bz2";
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~x64-macos"
+IUSE="ipv6 readline ssl tcpd"
+# bug #946404 (and many others), whack-a-mole with timeouts and friends
+# Try again in the future.
+RESTRICT="test"
+
+DEPEND="
+       ssl? ( >=dev-libs/openssl-3:= )
+       readline? ( sys-libs/readline:= )
+       tcpd? ( sys-apps/tcp-wrappers )
+"
+RDEPEND="${DEPEND}"
+
+DOCS=( BUGREPORTS CHANGES DEVELOPMENT EXAMPLES FAQ FILES PORTING README 
SECURITY )
+
+PATCHES=(
+       "${FILESDIR}/${PN}-1.8.1.0-musl-fix.patch" # #968110
+)
+
+src_configure() {
+       # bug #293324
+       filter-flags '-Wno-error*'
+
+       tc-export AR
+
+       local myeconfargs=(
+               $(use_enable ssl openssl)
+               $(use_enable readline)
+               $(use_enable ipv6 ip6)
+               $(use_enable tcpd libwrap)
+       )
+
+       econf "${myeconfargs[@]}"
+}
+
+src_test() {
+       # Most tests are skipped because they need network access or a TTY
+       # Some are for /dev permissions probing (bug #940740)
+       # 518 519 need extra permissions
+       edo ./test.sh -v --expect-fail 
13,15,87,217,311,313,370,388,410,466,478,518,519,528
+}
+
+src_install() {
+       default
+
+       docinto html
+       dodoc doc/*.html doc/*.css
+
+       if use elibc_musl; then
+               QA_CONFIG_IMPL_DECL_SKIP=( getprotobynumber_r )
+       fi
+}

Reply via email to