From c4cd8102e567862869868e01c74e1d5e64d4f451 Mon Sep 17 00:00:00 2001 From: David Michael Date: Sun, 19 Feb 2017 16:08:26 -0800 Subject: [PATCH 1/2] sys-libs/glibc: sync with upstream to version 2.23 --- .../coreos-overlay/sys-libs/glibc/Manifest | 4 +- .../glibc/files/eblits/pkg_postinst.eblit | 8 ++- .../glibc/files/eblits/pkg_preinst.eblit | 10 ++- .../glibc/files/eblits/pkg_pretend.eblit | 26 ++++++- .../glibc/files/eblits/src_compile.eblit | 14 +--- .../glibc/files/eblits/src_configure.eblit | 8 +++ .../glibc/files/eblits/src_install.eblit | 70 ++++++++++++++----- .../glibc/files/eblits/src_prepare.eblit | 4 +- ...bc-2.22-r5.ebuild => glibc-2.23-r3.ebuild} | 41 +++++------ 9 files changed, 126 insertions(+), 59 deletions(-) rename sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/{glibc-2.22-r5.ebuild => glibc-2.23-r3.ebuild} (85%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest index f5317a40bf..567aa5f07f 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/Manifest @@ -1,3 +1,3 @@ DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 SHA256 34aec5a59bb4d0ecf908c62fd418461d0f3793238296897687305fd7a1f27299 SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269 WHIRLPOOL bbce19e7fe5c30faa55ddd4e29070f0d1fdfca3a04e8d68e0772260fa9be89ccde63ec92badb490209008df5fee6e53dfdeec4ae51857b90ba298a79315a199f -DIST glibc-2.22-patches-13.tar.bz2 74479 SHA256 ffd1e0f9a41be030e5ce2518d9e84a1fbaa9a4fb2e96f1b85dafb05fea666c86 SHA512 73517fc1502b0733d67ade1d1ba6168415f5da64f37045fac0b10ef57155bf6dfbe1876e4742d2543fcea0c935c179426f6fbb94f0205968392ef903d2f83897 WHIRLPOOL 0eeedaf09eb42e5186256dd41aae00cd2b9b8e3ab929a792e83d0fd8e8a8630d829f01b293588bf59e105eb17ab512416d8d115c3e542cddc34a84b84d56af3d -DIST glibc-2.22.tar.xz 12969072 SHA256 eb731406903befef1d8f878a46be75ef862b9056ab0cde1626d08a7a05328948 SHA512 a8719f3a4f8aa5fa81711116fdafbea5082c6dfd85bd8c4cdce60571910263ab422b35bb8b55a84d37ccb146442133ba60a84d453ca4a439c8ccd35419bd051b WHIRLPOOL f7e707b3776fc197a2e7bf5633721925507237b154bbc1f94b9fc303c87e6fc039ff0758da6ee55b4c1a0daaa87c6e594a6c96e7b00a7ba8ae98ee29918709a7 +DIST glibc-2.23-patches-7.tar.bz2 315221 SHA256 97ef9e370ce9b09d8e9b9f6239f7ef94dd837d29b7bfc1404438c63da1d534ac SHA512 c0d0cab0a370acef0b085b0ab09ce868425a12bbb371d0a9ff91dc83a74a0d8d3b541d10c44650b00b7cb155f8ac1f87764e6a6bd9d6bae8a9a904b4df1650ef WHIRLPOOL 128ea1a2eeaad3d95cdf1054d10232a34e8f88d10ed8907a67d9ff02734243d20b21595ca3698a4861d9c65e2a59aedbcf8e399bd1ed879dba1556ce2995ad9b +DIST glibc-2.23.tar.xz 13455260 SHA256 94efeb00e4603c8546209cefb3e1a50a5315c86fa9b078b6fad758e187ce13e9 SHA512 b82953388cd028e174cb08f082557bbce0dad8b67b17d31b29f90102fd52a51e03d591448ecb64882a1c1d5303afffc7f6ede85cee4c784a9284fbc9b4ad26cf WHIRLPOOL 7c7e3bf55a89a04bac917b9ca5a1cbb1613f22c427d2766f114b5a36f9635856005b823852ef5d3b73462b577fe4e5865e68e7b64633d48a95fa1e5eaa831a71 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit index 827cba9b51..8178fa1fdb 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit @@ -16,6 +16,12 @@ eblit-glibc-pkg_postinst() { # errors from this step #253697 /sbin/telinit U 2>/dev/null - ## COREOS: locale-gen is not installed + # if the host locales.gen contains no entries, we'll install everything + local locale_list="${EROOT}etc/locale.gen" + if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then + ewarn "Generating all locales; edit /etc/locale.gen to save time/space" + locale_list="${EROOT}usr/share/i18n/SUPPORTED" + fi + locale-gen -j $(makeopts_jobs) --config "${locale_list}" fi } diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit index 44735dadfc..a7975e2966 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -46,11 +46,15 @@ eblit-glibc-pkg_preinst() { # prepare /etc/ld.so.conf.d/ for files mkdir -p "${EROOT}"/etc/ld.so.conf.d - ## COREOS: host.conf is not installed + # Default /etc/hosts.conf:multi to on for systems with small dbs. + if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then + sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf + elog "Defaulting /etc/host.conf:multi to on" + fi [[ ${ROOT} != "/" ]] && return 0 [[ -d ${ED}/$(get_libdir) ]] || return 0 - glibc_sanity_check + [[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check # For newer EAPIs, this was run in pkg_pretend. if [[ ${EAPI:-0} == [0123] ]] ; then diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit index 03c947f3e3..47e2987274 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit @@ -46,8 +46,30 @@ glibc_run_test() { } check_devpts() { - ## COREOS: Ignore /dev/pts settings, the chroot has no control over them. - return 0 + # Make sure devpts is mounted correctly for use w/out setuid pt_chown. + + # If merely building the binary package, then there's nothing to verify. + [[ ${MERGE_TYPE} == "buildonly" ]] && return + + # Only sanity check when installing the native glibc. + [[ ${ROOT} != "/" ]] && return + + # Older versions always installed setuid, so no need to check. + in_iuse suid || return + + # If they're opting in to the old suid code, then no need to check. + use suid && return + + if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then + eerror "In order to use glibc with USE=-suid, you must make sure that" + eerror "you have devpts mounted at /dev/pts with the gid=5 option." + eerror "Openrc should do this for you, so you should check /etc/fstab" + eerror "and make sure you do not have any invalid settings there." + # Do not die on older kernels as devpts did not export these settings #489520. + if version_is_at_least 2.6.25 $(uname -r) ; then + die "mount & fix your /dev/pts settings" + fi + fi } eblit-glibc-pkg_pretend() { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit index 6d513fc1d1..7a38b3e6e4 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit @@ -14,21 +14,9 @@ toolchain-glibc_src_compile() { done } -## COREOS: fix compilation of cross-rpcgen during compiler bootstrap -toolchain-glibc_headers_compile() { - [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure - - tc-export_build_env - local builddir=$(builddir "headers") - cd "${builddir}" - emake -C "${S}/sunrpc" subdir=sunrpc objdir="${builddir}" \ - "${builddir}/sunrpc/cross-rpcgen" || die "make cross-rpcgen failed" -} - eblit-glibc-src_compile() { if just_headers ; then - export ABI=default - toolchain-glibc_headers_compile + [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure return fi diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit index 396bce52ca..c1e6a2d171 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_configure.eblit @@ -226,6 +226,14 @@ toolchain-glibc_headers_configure() { pushd "${S}"/sysdeps/mips >/dev/null sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=32:' mips32/Makefile mips64/n32/Makefile || die sed -i -e '/^CC +=/s:=.*:= -D_MIPS_SZPTR=64:' mips64/n64/Makefile || die + if version_is_at_least 2.21 ; then + # Force the mips ABI to the default. This is OK because the set of + # installed headers in this phase is the same between the 3 ABIs. + # If this ever changes, this hack will break, but that's unlikely + # as glibc discourages that behavior. + # https://crbug.com/647033 + sed -i -e 's:abiflag=.*:abiflag=_ABIO32:' preconfigure || die + fi popd >/dev/null fi diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit index a5be641ddb..11ef2a4d2a 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit @@ -51,6 +51,12 @@ toolchain-glibc_src_install() { cp -a elf/ld.so "${ED}"$(alt_libdir)/$(scanelf -qSF'%S#F' elf/ld.so) || die "copying nptl interp" fi + # Newer versions get fancy with libm linkage to include vectorized support. + # While we don't really need a ldscript here, portage QA checks get upset. + if [[ -e ${ED}$(alt_usrlibdir)/libm-${PV}.a ]] ; then + dosym ../../$(get_libdir)/libm-${PV}.so $(alt_usrlibdir)/libm-${PV}.so + fi + # We'll take care of the cache ourselves rm -f "${ED}"/etc/ld.so.cache @@ -133,40 +139,70 @@ toolchain-glibc_src_install() { return 0 fi - ## COREOS ## - # For reference, the rest of this function has been modified to do: - # - The SDK just gets the full locale archive, no need for locale-gen. - # - CoreOS targets (which are cross compiled) don't get any locales. - # - Config files are installed by baselayout, not glibc. - # - Forget about nscd for now, we have the use flag off anyway. - - if ! tc-is-cross-compiler ; then - emake install_root="${D}$(alt_prefix)" localedata/install-locales || die - # Sanity check the above command worked - [[ -f ${ED}/usr/$(get_libdir)/locale/locale-archive ]] || die - else - keepdir /usr/$(get_libdir)/locale - fi + # Files for Debian-style locale updating + dodir /usr/share/i18n + sed \ + -e "/^#/d" \ + -e "/SUPPORTED-LOCALES=/d" \ + -e "s: \\\\::g" -e "s:/: :g" \ + "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ + || die "generating /usr/share/i18n/SUPPORTED failed" + cd "${WORKDIR}"/extra/locale + dosbin locale-gen || die + doman *.[0-8] + insinto /etc + doins locale.gen || die # Make sure all the ABI's can find the locales and so we only # have to generate one set local a + keepdir /usr/$(get_libdir)/locale for a in $(get_install_abis) ; do if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale fi done - # Clean out any default configs - rm -rf "${ED}"/etc + cd "${S}" + + # Install misc network config files + insinto /etc + doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die + doins "${WORKDIR}"/extra/etc/*.conf || die + + if ! in_iuse nscd || use nscd ; then + doinitd "${WORKDIR}"/extra/etc/nscd || die + + local nscd_args=( + -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" + ) + version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' ) + sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd + + # Newer versions of glibc include the nscd.service themselves. + # TODO: Drop the $FILESDIR copy once 2.19 goes stable. + if version_is_at_least 2.19 ; then + systemd_dounit nscd/nscd.service || die + systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die + else + systemd_dounit "${FILESDIR}"/nscd.service || die + systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die + fi + else + # Do this since extra/etc/*.conf above might have nscd.conf. + rm -f "${ED}"/etc/nscd.conf + fi echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc doenvd "${T}"/00glibc || die - cd "${S}" for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do [[ -s ${d} ]] && dodoc ${d} done + + # Prevent overwriting of the /etc/localtime symlink. We'll handle the + # creation of the "factory" symlink in pkg_postinst(). + rm -f "${ED}"/etc/localtime } toolchain-glibc_headers_install() { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_prepare.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_prepare.eblit index 4a5c8af7f6..11ff7af6f8 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_prepare.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_prepare.eblit @@ -1,4 +1,4 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -58,6 +58,8 @@ eblit-glibc-src_prepare() { find . -type f '(' -size 0 -o -name "*.orig" ')' -delete find . -name configure -exec touch {} + + eprefixify extra/locale/locale-gen + # Fix permissions on some of the scripts. chmod u+x "${S}"/scripts/*.sh } diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.22-r5.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild similarity index 85% rename from sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.22-r5.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild index eceae7cc35..971f8978c9 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.22-r5.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild @@ -1,16 +1,16 @@ -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ EAPI="4" -inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing +inherit eutils versionator toolchain-funcs flag-o-matic gnuconfig multilib systemd unpacker multiprocessing prefix DESCRIPTION="GNU libc6 (also called glibc2) C library" HOMEPAGE="https://www.gnu.org/software/libc/libc.html" LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" -KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86" +KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh ~sparc x86" RESTRICT="strip" # strip ourself #46186 EMULTILIB_PKG="true" @@ -27,10 +27,10 @@ case ${PV} in ;; esac GCC_BOOTSTRAP_VER="4.7.3-r1" -PATCH_VER="13" # Gentoo patchset +PATCH_VER="7" # Gentoo patchset : ${NPTL_KERN_VER:="2.6.32"} # min kernel version nptl requires -IUSE="debug gd hardened multilib nscd selinux systemtap profile suid vanilla crosscompile_opts_headers-only" +IUSE="audit caps debug gd hardened multilib nscd +rpc selinux systemtap profile suid vanilla crosscompile_opts_headers-only" # Here's how the cross-compile logic breaks down ... # CTARGET - machine that will target the binaries @@ -64,25 +64,33 @@ SLOT="2.2" # General: We need a new-enough binutils/gcc to match upstream baseline. # arch: we need to make sure our binutils/gcc supports TLS. -DEPEND=">=app-misc/pax-utils-0.1.10 - ! Date: Sun, 19 Feb 2017 17:20:12 -0800 Subject: [PATCH 2/2] sys-libs/glibc: apply CoreOS changes --- .../glibc-2.23-gshadow-handle-erange.patch | 113 +++++++++++++++--- .../glibc/files/eblits/pkg_postinst.eblit | 8 +- .../glibc/files/eblits/pkg_preinst.eblit | 6 +- .../glibc/files/eblits/pkg_pretend.eblit | 26 +--- .../glibc/files/eblits/src_compile.eblit | 11 ++ .../glibc/files/eblits/src_install.eblit | 64 +++------- .../sys-libs/glibc/glibc-2.23-r3.ebuild | 4 + 7 files changed, 134 insertions(+), 98 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/2.23/glibc-2.23-gshadow-handle-erange.patch b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/2.23/glibc-2.23-gshadow-handle-erange.patch index 7ccf8aef88..d223e9f088 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/2.23/glibc-2.23-gshadow-handle-erange.patch +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/2.23/glibc-2.23-gshadow-handle-erange.patch @@ -1,31 +1,114 @@ ---- gshadow/fgetsgent_r.c -+++ gshadow/fgetsgent_r.c -@@ -37,6 +37,7 @@ +From 74250a7cdf106d4ca7d9506e6d5dc7c448dc3434 Mon Sep 17 00:00:00 2001 +From: David Michael +Date: Thu, 15 Dec 2016 15:22:57 -0800 +Subject: [PATCH] gshadow: Sync fgetsgent_r.c with grp/fgetgrent_r.c + + [BZ #20338] + * gshadow/fgetsgent_r.c: Include . + (flockfile): New macro. + (funlockfile): Likewise. + (__fgetsgent_r): Sync with __fgetgrent_r. + * nss/nss_files/files-sgrp.c: Fix "fgetsgent_r.c" typo. +--- + gshadow/fgetsgent_r.c | 35 ++++++++++++++++++++++++----------- + nss/nss_files/files-sgrp.c | 2 +- + 2 files changed, 25 insertions(+), 12 deletions(-) + +diff --git a/gshadow/fgetsgent_r.c b/gshadow/fgetsgent_r.c +index b70f6fa..02cd33a 100644 +--- a/gshadow/fgetsgent_r.c ++++ b/gshadow/fgetsgent_r.c +@@ -20,39 +20,44 @@ + #include + #include + ++#include ++#define flockfile(s) _IO_flockfile (s) ++#define funlockfile(s) _IO_funlockfile (s) ++ + /* Define a line parsing function using the common code + used in the nss_files module. */ + + #define STRUCTURE sgrp + #define ENTNAME sgent +-#define EXTERN_PARSER 1 ++#define EXTERN_PARSER 1 + struct sgent_data {}; + + #include + + +-/* Read one shadow entry from the given stream. */ ++/* Read one entry from the given stream. */ + int + __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen, struct sgrp **result) { char *p; -+ int rc; ++ int parse_result; - _IO_flockfile (stream); +- _IO_flockfile (stream); ++ flockfile (stream); do -@@ -64,11 +65,18 @@ - } while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */ + { + buffer[buflen - 1] = '\xff'; + p = fgets_unlocked (buffer, buflen, stream); +- if (p == NULL && feof_unlocked (stream)) ++ if (__builtin_expect (p == NULL, 0) && feof_unlocked (stream)) + { +- _IO_funlockfile (stream); ++ funlockfile (stream); + *result = NULL; + __set_errno (ENOENT); + return errno; + } +- if (p == NULL || buffer[buflen - 1] != '\xff') ++ if (__builtin_expect (p == NULL, 0) || buffer[buflen - 1] != '\xff') + { +- _IO_funlockfile (stream); ++ funlockfile (stream); + *result = NULL; + __set_errno (ERANGE); + return errno; +@@ -61,13 +66,21 @@ __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen, + /* Skip leading blanks. */ + while (isspace (*p)) + ++p; +- } while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */ ++ } while (*p == '\0' || *p == '#' /* Ignore empty and comment lines. */ /* Parse the line. If it is invalid, loop to get the next line of the file to parse. */ - ! parse_line (buffer, (void *) resbuf, (void *) buffer, buflen, - &errno)); -+ !(rc = parse_line (buffer, (void *) resbuf, -+ (void *) buffer, buflen, &errno))); ++ || ! (parse_result = parse_line (p, resbuf, ++ (void *) buffer, buflen, ++ &errno))); ++ ++ funlockfile (stream); - _IO_funlockfile (stream); - -+ if (rc < 0) +- _IO_funlockfile (stream); ++ if (__builtin_expect (parse_result, 0) == -1) + { ++ /* The parser ran out of space. */ + *result = NULL; -+ __set_errno (ERANGE); + return errno; + } -+ + *result = resbuf; return 0; - } +diff --git a/nss/nss_files/files-sgrp.c b/nss/nss_files/files-sgrp.c +index 15dc659..05c3805 100644 +--- a/nss/nss_files/files-sgrp.c ++++ b/nss/nss_files/files-sgrp.c +@@ -23,7 +23,7 @@ + #define DATABASE "gshadow" + struct sgent_data {}; + +-/* Our parser function is already defined in sgetspent_r.c, so use that ++/* Our parser function is already defined in sgetsgent_r.c, so use that + to parse lines from the database file. */ + #define EXTERN_PARSER + #include "files-parse.c" +-- +2.7.4 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit index 8178fa1fdb..827cba9b51 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_postinst.eblit @@ -16,12 +16,6 @@ eblit-glibc-pkg_postinst() { # errors from this step #253697 /sbin/telinit U 2>/dev/null - # if the host locales.gen contains no entries, we'll install everything - local locale_list="${EROOT}etc/locale.gen" - if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then - ewarn "Generating all locales; edit /etc/locale.gen to save time/space" - locale_list="${EROOT}usr/share/i18n/SUPPORTED" - fi - locale-gen -j $(makeopts_jobs) --config "${locale_list}" + ## COREOS: locale-gen is not installed fi } diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit index a7975e2966..65c7c958af 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_preinst.eblit @@ -46,11 +46,7 @@ eblit-glibc-pkg_preinst() { # prepare /etc/ld.so.conf.d/ for files mkdir -p "${EROOT}"/etc/ld.so.conf.d - # Default /etc/hosts.conf:multi to on for systems with small dbs. - if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then - sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf - elog "Defaulting /etc/host.conf:multi to on" - fi + ## COREOS: host.conf is not installed [[ ${ROOT} != "/" ]] && return 0 [[ -d ${ED}/$(get_libdir) ]] || return 0 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit index 47e2987274..03c947f3e3 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/pkg_pretend.eblit @@ -46,30 +46,8 @@ glibc_run_test() { } check_devpts() { - # Make sure devpts is mounted correctly for use w/out setuid pt_chown. - - # If merely building the binary package, then there's nothing to verify. - [[ ${MERGE_TYPE} == "buildonly" ]] && return - - # Only sanity check when installing the native glibc. - [[ ${ROOT} != "/" ]] && return - - # Older versions always installed setuid, so no need to check. - in_iuse suid || return - - # If they're opting in to the old suid code, then no need to check. - use suid && return - - if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then - eerror "In order to use glibc with USE=-suid, you must make sure that" - eerror "you have devpts mounted at /dev/pts with the gid=5 option." - eerror "Openrc should do this for you, so you should check /etc/fstab" - eerror "and make sure you do not have any invalid settings there." - # Do not die on older kernels as devpts did not export these settings #489520. - if version_is_at_least 2.6.25 $(uname -r) ; then - die "mount & fix your /dev/pts settings" - fi - fi + ## COREOS: Ignore /dev/pts settings, the chroot has no control over them. + return 0 } eblit-glibc-pkg_pretend() { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit index 7a38b3e6e4..2d9aa90bb3 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_compile.eblit @@ -14,6 +14,17 @@ toolchain-glibc_src_compile() { done } +## COREOS: fix compilation of cross-rpcgen during compiler bootstrap +toolchain-glibc_headers_compile() { + [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure + + tc-export_build_env + local builddir=$(builddir "headers") + cd "${builddir}" + emake -C "${S}/sunrpc" subdir=sunrpc objdir="${builddir}" \ + "${builddir}/sunrpc/cross-rpcgen" || die "make cross-rpcgen failed" +} + eblit-glibc-src_compile() { if just_headers ; then [[ ${EAPI:-0} == [01] ]] && toolchain-glibc_headers_configure diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit index 11ef2a4d2a..bb20991e55 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/files/eblits/src_install.eblit @@ -139,70 +139,40 @@ toolchain-glibc_src_install() { return 0 fi - # Files for Debian-style locale updating - dodir /usr/share/i18n - sed \ - -e "/^#/d" \ - -e "/SUPPORTED-LOCALES=/d" \ - -e "s: \\\\::g" -e "s:/: :g" \ - "${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \ - || die "generating /usr/share/i18n/SUPPORTED failed" - cd "${WORKDIR}"/extra/locale - dosbin locale-gen || die - doman *.[0-8] - insinto /etc - doins locale.gen || die + ## COREOS ## + # For reference, the rest of this function has been modified to do: + # - The SDK just gets the full locale archive, no need for locale-gen. + # - CoreOS targets (which are cross compiled) don't get any locales. + # - Config files are installed by baselayout, not glibc. + # - Forget about nscd for now, we have the use flag off anyway. + + if ! tc-is-cross-compiler ; then + emake install_root="${D}$(alt_prefix)" localedata/install-locales || die + # Sanity check the above command worked + [[ -f ${ED}/usr/$(get_libdir)/locale/locale-archive ]] || die + else + keepdir /usr/$(get_libdir)/locale + fi # Make sure all the ABI's can find the locales and so we only # have to generate one set local a - keepdir /usr/$(get_libdir)/locale for a in $(get_install_abis) ; do if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale fi done - cd "${S}" - - # Install misc network config files - insinto /etc - doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die - doins "${WORKDIR}"/extra/etc/*.conf || die - - if ! in_iuse nscd || use nscd ; then - doinitd "${WORKDIR}"/extra/etc/nscd || die - - local nscd_args=( - -e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):" - ) - version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' ) - sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd - - # Newer versions of glibc include the nscd.service themselves. - # TODO: Drop the $FILESDIR copy once 2.19 goes stable. - if version_is_at_least 2.19 ; then - systemd_dounit nscd/nscd.service || die - systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die - else - systemd_dounit "${FILESDIR}"/nscd.service || die - systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die - fi - else - # Do this since extra/etc/*.conf above might have nscd.conf. - rm -f "${ED}"/etc/nscd.conf - fi + # Clean out any default configs + rm -rf "${ED}"/etc echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc doenvd "${T}"/00glibc || die + cd "${S}" for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do [[ -s ${d} ]] && dodoc ${d} done - - # Prevent overwriting of the /etc/localtime symlink. We'll handle the - # creation of the "factory" symlink in pkg_postinst(). - rm -f "${ED}"/etc/localtime } toolchain-glibc_headers_install() { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild index 971f8978c9..a649c6ce16 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/glibc/glibc-2.23-r3.ebuild @@ -169,6 +169,10 @@ eblit-src_prepare-post() { cd "${S}" epatch "${FILESDIR}"/2.19/${PN}-2.19-ia64-gcc-4.8-reloc-hack.patch #503838 + ## COREOS: features and bug fixes missing from the Gentoo patch set. + epatch "${FILESDIR}"/2.23/glibc-2.23-gshadow-handle-erange.patch + epatch "${FILESDIR}"/2.23/glibc-2.23-c-utf8-locale.patch + epatch "${FILESDIR}"/2.23/glibc-2.23-pthread-use-after-free.patch if use hardened ; then # We don't enable these for non-hardened as the output is very terse --