diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2018-10-02 19:42:46 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2018-10-02 19:42:46 -0400 |
commit | cf5756d9f7c89635bf73b4f781f464b24019a77c (patch) | |
tree | 5388da105438cc13759f7bd4edcfca1eb3bdf458 /sys-libs | |
parent | sys-apps/s6: Add proxy-maint, Samuel, myself as maintainers (diff) | |
download | gentoo-cf5756d9f7c89635bf73b4f781f464b24019a77c.tar.gz gentoo-cf5756d9f7c89635bf73b4f781f464b24019a77c.tar.bz2 gentoo-cf5756d9f7c89635bf73b4f781f464b24019a77c.zip |
sys-libs/musl: fix bug #667234
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.10
Diffstat (limited to 'sys-libs')
-rw-r--r-- | sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch | 51 | ||||
-rw-r--r-- | sys-libs/musl/musl-1.1.20-r1.ebuild | 123 |
2 files changed, 174 insertions, 0 deletions
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 000000000000..28d4558b8b6c --- /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 000000000000..cba85ae6bb6b --- /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 +} |