public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
Date: Tue,  2 Oct 2018 23:43:58 +0000 (UTC)	[thread overview]
Message-ID: <1538523766.cf5756d9f7c89635bf73b4f781f464b24019a77c.blueness@gentoo> (raw)

commit:     cf5756d9f7c89635bf73b4f781f464b24019a77c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  2 23:42:46 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Oct  2 23:42:46 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf5756d9

sys-libs/musl: fix bug #667234

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.10

 .../musl/files/musl-1.1.20-fix-getaddrinfo.patch   |  51 +++++++++
 sys-libs/musl/musl-1.1.20-r1.ebuild                | 123 +++++++++++++++++++++
 2 files changed, 174 insertions(+)

diff --git a/sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch b/sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch
new file mode 100644
index 00000000000..28d4558b8b6
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch
@@ -0,0 +1,51 @@
+From f381c118b2d4f7d914481d3cdc830ce41369b002 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 19 Sep 2018 18:03:22 -0400
+Subject: fix getaddrinfo regression with AI_ADDRCONFIG on some configurations
+
+despite not being documented to do so in the standard or Linux
+documentation, attempts to udp connect to 127.0.0.1 or ::1 generate
+EADDRNOTAVAIL when the loopback device is not configured and there is
+no default route for IPv6. this caused getaddrinfo with AI_ADDRCONFIG
+to fail with EAI_SYSTEM and EADDRNOTAVAIL on some no-IPv6
+configurations, rather than the intended behavior of detecting IPv6 as
+unsuppported and producing IPv4-only results.
+
+previously, only EAFNOSUPPORT was treated as unavailability of the
+address family being probed. instead, treat all errors related to
+inability to get an address or route as conclusive that the family
+being probed is unsupported, and only fail with EAI_SYSTEM on other
+errors.
+
+further improvements may be desirable, such as reporting EAI_AGAIN
+instead of EAI_SYSTEM for errors which are expected to be transient,
+but this patch should suffice to fix the serious regression.
+---
+ src/network/getaddrinfo.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
+index ba26847a..e33bfa28 100644
+--- a/src/network/getaddrinfo.c
++++ b/src/network/getaddrinfo.c
+@@ -76,7 +76,16 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
+ 				close(s);
+ 				if (!r) continue;
+ 			}
+-			if (errno != EAFNOSUPPORT) return EAI_SYSTEM;
++			switch (errno) {
++			case EADDRNOTAVAIL:
++			case EAFNOSUPPORT:
++			case EHOSTUNREACH:
++			case ENETDOWN:
++			case ENETUNREACH:
++				break;
++			default:
++				return EAI_SYSTEM;
++			}
+ 			if (family == tf[i]) return EAI_NONAME;
+ 			family = tf[1-i];
+ 		}
+-- 
+cgit v1.2.1
+

diff --git a/sys-libs/musl/musl-1.1.20-r1.ebuild b/sys-libs/musl/musl-1.1.20-r1.ebuild
new file mode 100644
index 00000000000..cba85ae6bb6
--- /dev/null
+++ b/sys-libs/musl/musl-1.1.20-r1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="git://git.musl-libc.org/musl"
+	inherit git-r3
+	SRC_URI="
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://dev.gentoo.org/~blueness/musl-misc/getent.c
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
+	KEYWORDS=""
+else
+	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://dev.gentoo.org/~blueness/musl-misc/getent.c
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
+	KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~ppc ~x86"
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="http://www.musl-libc.org/"
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="headers-only"
+
+QA_SONAME="/usr/lib/libc.so"
+QA_DT_NEEDED="/usr/lib/libc.so"
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	use headers-only && is_crosscompile
+}
+
+pkg_setup() {
+	if [ ${CTARGET} == ${CHOST} ] ; then
+		case ${CHOST} in
+		*-musl*) ;;
+		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+		esac
+	fi
+}
+
+src_prepare() {
+	eapply "${FILESDIR}/${P}-fix-getaddrinfo.patch"
+	eapply_user
+}
+
+src_configure() {
+	tc-getCC ${CTARGET}
+	just_headers && export CC=true
+
+	local sysroot
+	is_crosscompile && sysroot=/usr/${CTARGET}
+	./configure \
+		--target=${CTARGET} \
+		--prefix=${sysroot}/usr \
+		--syslibdir=${sysroot}/lib \
+		--disable-gcc-wrapper || die
+}
+
+src_compile() {
+	emake obj/include/bits/alltypes.h
+	just_headers && return 0
+
+	emake
+	if [[ ${CATEGORY} != cross-* ]] ; then
+		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/getconf.c -o "${T}"/getconf || die
+		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/getent.c -o "${T}"/getent || die
+		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/iconv.c -o "${T}"/iconv || die
+	fi
+}
+
+src_install() {
+	local target="install"
+	just_headers && target="install-headers"
+	emake DESTDIR="${D}" ${target}
+	just_headers && return 0
+
+	# musl provides ldd via a sym link to its ld.so
+	local sysroot
+	is_crosscompile && sysroot=/usr/${CTARGET}
+	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
+	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+
+	if [[ ${CATEGORY} != cross-* ]] ; then
+		local arch=$("${D}"usr/lib/libc.so 2>&1 | sed -n '1s/^musl libc (\(.*\))$/\1/p')
+		[[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die
+		cp "${FILESDIR}"/ldconfig.in "${T}" || die
+		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		into /
+		dosbin "${T}"/ldconfig
+		into /usr
+		dobin "${T}"/getconf
+		dobin "${T}"/getent
+		dobin "${T}"/iconv
+		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
+		doenvd "${T}"/00musl || die
+	fi
+}
+
+pkg_postinst() {
+	is_crosscompile && return 0
+
+	[ "${ROOT}" != "/" ] && return 0
+
+	ldconfig || die
+	# reload init ...
+	/sbin/telinit U 2>/dev/null
+}


             reply	other threads:[~2018-10-02 23:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 23:43 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-13 17:43 [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/ Petr Vaněk
2024-05-20  8:16 Sam James
2023-11-09  0:57 Sam James
2022-07-26  4:15 Sam James
2022-04-17 18:32 Sam James
2022-02-20  0:31 Sam James
2021-11-22 12:18 Sam James
2021-11-19  3:03 Sam James
2021-02-14 16:50 Jory Pratt
2016-10-18 23:53 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1538523766.cf5756d9f7c89635bf73b4f781f464b24019a77c.blueness@gentoo \
    --to=blueness@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox