diff options
author | Patrick J Volkerding <volkerdi@slackware.com> | 2023-09-28 21:37:06 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2023-09-29 00:41:46 +0200 |
commit | e9c0b54c5cc41c2482d05f82b68e6bc6abfc0e77 (patch) | |
tree | 760907293e8313a935a76dd563c3a5eeb21d9594 /testing | |
parent | d5cee66c5760e888f2b53c2e21453a3b11832425 (diff) | |
download | current-e9c0b54c5cc41c2482d05f82b68e6bc6abfc0e77.tar.gz current-e9c0b54c5cc41c2482d05f82b68e6bc6abfc0e77.tar.xz |
Thu Sep 28 21:37:06 UTC 202320230928213706
ap/mpg123-1.32.2-x86_64-1.txz: Upgraded.
l/cairo-1.18.0-x86_64-1.txz: Upgraded.
l/gtk4-4.12.3-x86_64-1.txz: Upgraded.
x/fonttosfnt-1.2.3-x86_64-1.txz: Upgraded.
xap/geeqie-2.1-x86_64-2.txz: Rebuilt.
Patched and recompiled against lua-5.4.6.
xap/mozilla-firefox-115.3.1esr-x86_64-1.txz: Upgraded.
This update contains a security fix.
For more information, see:
https://www.mozilla.org/en-US/firefox/115.3.1/releasenotes/
https://www.mozilla.org/en-US/security/advisories/mfsa2023-44/
https://www.cve.org/CVERecord?id=CVE-2023-5217
(* Security fix *)
xfce/xfce4-panel-4.18.5-x86_64-1.txz: Upgraded.
testing/packages/aaa_glibc-solibs-2.38-x86_64-1.txz: Added.
testing/packages/glibc-2.38-x86_64-1.txz: Added.
Instead of building the deprecated glibc crypt library, bundle
libxcrypt-4.4.36 (both .so.1 compat version and .so.2 new API version).
testing/packages/glibc-i18n-2.38-x86_64-1.txz: Added.
testing/packages/glibc-profile-2.38-x86_64-1.txz: Added.
Diffstat (limited to 'testing')
18 files changed, 1897 insertions, 0 deletions
diff --git a/testing/source/glibc/doinst.sh-aaa_glibc-solibs b/testing/source/glibc/doinst.sh-aaa_glibc-solibs new file mode 100644 index 000000000..fe8fc1f37 --- /dev/null +++ b/testing/source/glibc/doinst.sh-aaa_glibc-solibs @@ -0,0 +1,158 @@ +#!/bin/sh +# Copyright (C) 2002, 2005 Slackware Linux, Inc. +# Copyright 2005, 2006, 2011, 2012, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Swap glibc on the fly. +# +# If we're on a running system we have to handle this _very_ carefully. :-) +# The tricks involved here get trickier every time... + +# OK, now we have to be sure of a few things. First, you do have a 2.6 +# kernel running, right? + +if [ -r /proc/ksyms ]; then + echo "FATAL: you need to be running a 2.6.x kernel in order to upgrade" + echo "to this version of glibc." + echo + sleep 999 + exit 1 +fi + +# Next, stop using the /lib/ntpl libraries. These are now obsolete and +# will break the installation if present: +if [ -d lib/tls ]; then + mkdir -p lib/obsolete + mv lib/tls lib/obsolete +fi +if [ -x sbin/ldconfig ]; then + sbin/ldconfig -r . 2> /dev/null +fi + +# Install NPTL glibc libraries: +if [ -x /sbin/ldconfig -a -d lib/incoming ]; then # swap on the fly + # Try to protect with flock against another installpkg/removepkg running + # ldconfig while we're doing the on-the-fly install: + mkdir -p run/lock/pkgtools + ( flock 9 || exit 11 + # First create copies of the incoming libraries: + ( cd lib/incoming + for file in * ; do + if [ ! -r ../${file}.incoming ]; then + cp -a $file ../${file}.incoming + fi + done + ) + # Then switch to them all at once: + /sbin/ldconfig -l lib/*.incoming 2> /dev/null + # Remove old versions of the glibc libraries. If you really don't want to + # do this for some reason, create a file /etc/glibc-nowipe. + if [ ! -r etc/glibc-nowipe ]; then + ( cd lib + for INCOMING in incoming/*-* ; do + LIBPREFIX=$(basename $INCOMING | cut -f 1 -d -) + for LIBRARY in ${LIBPREFIX}-* ; do + # Don't remove the library if it ends in .incoming: + if [ "$(echo $LIBRARY | rev | cut -f 1 -d .)" = "gnimocni" ]; then + continue + fi + # Don't remove symlinks: + if [ -L $LIBRARY ]; then + continue + fi + rm -f $LIBRARY + done + done + # Remove stale versions of libcrypt from Slackware 14.2 or newer: + rm -f libcrypt-{2.23,2.24,2.25,2.26,2.27,2.28,2.29,2.30,2.31,2.32,2.33,2.34,2.35,2.36,2.37}.so + ) + fi + # Finally, rename them and clean up: + ( cd lib + for file in *.incoming ; do + rm -f `basename $file .incoming` + cp -a $file `basename $file .incoming` + /sbin/ldconfig -l `basename $file .incoming` 2> /dev/null + rm -f $file + done + ) + ) 9> run/lock/pkgtools/ldconfig.lock +else # no ldconfig? This is a broken situation, but we will do what we can: + ( cd lib/incoming + for file in * ; do + cp -a $file .. + done + ) +fi +# Now, get rid of the temporary directory: +rm -rf lib/incoming +# Done installing NPTL glibc libraries. + +# Handle config files: +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +config etc/profile.d/glibc.csh.new +config etc/profile.d/glibc.sh.new +# Clearly you already decided this issue. :-) +rm -f etc/profile.d/glibc.csh.new +rm -f etc/profile.d/glibc.sh.new + +# This block below *should* be dead code, but it's probably safer to leave it +# here as a fallback. It no longer has complete coverage of all the links +# that would be needed in /lib${LIBDIRSUFFIX}, but it covers enough that if +# we did fall back on this the machine would boot until it reached the boot +# time call to ldconfig, which would then take care of any missing links. +if [ ! -x /sbin/ldconfig ]; then +( cd lib ; rm -rf libm.so.6 ) +( cd lib ; ln -sf libm-@@VERSION@@.so libm.so.6 ) +( cd lib ; rm -rf libnss_files.so.2 ) +( cd lib ; ln -sf libnss_files-@@VERSION@@.so libnss_files.so.2 ) +( cd lib ; rm -rf libresolv.so.2 ) +( cd lib ; ln -sf libresolv-@@VERSION@@.so libresolv.so.2 ) +( cd lib ; rm -rf libutil.so.1 ) +( cd lib ; ln -sf libutil-@@VERSION@@.so libutil.so.1 ) +( cd lib ; rm -rf libnss_compat.so.2 ) +( cd lib ; ln -sf libnss_compat-@@VERSION@@.so libnss_compat.so.2 ) +( cd lib ; rm -rf libthread_db.so.1 ) +( cd lib ; ln -sf libthread_db-1.0.so libthread_db.so.1 ) +( cd lib ; rm -rf libnss_hesiod.so.2 ) +( cd lib ; ln -sf libnss_hesiod-@@VERSION@@.so libnss_hesiod.so.2 ) +( cd lib ; rm -rf libanl.so.1 ) +( cd lib ; ln -sf libanl-@@VERSION@@.so libanl.so.1 ) +( cd lib ; rm -rf libcrypt.so.1 ) +( cd lib ; ln -sf libcrypt1-@@VERSION@@.so libcrypt.so.1 ) +( cd lib ; rm -rf libcrypt.so.2 ) +( cd lib ; ln -sf libcrypt2-@@VERSION@@.so libcrypt.so.2 ) +( cd lib ; rm -rf libBrokenLocale.so.1 ) +( cd lib ; ln -sf libBrokenLocale-@@VERSION@@.so libBrokenLocale.so.1 ) +( cd lib ; rm -rf ld-linux.so.2 ) +( cd lib ; ln -sf ld-@@VERSION@@.so ld-linux.so.2 ) +( cd lib ; rm -rf libdl.so.2 ) +( cd lib ; ln -sf libdl-@@VERSION@@.so libdl.so.2 ) +( cd lib ; rm -rf libnss_dns.so.2 ) +( cd lib ; ln -sf libnss_dns-@@VERSION@@.so libnss_dns.so.2 ) +( cd lib ; rm -rf libpthread.so.0 ) +( cd lib ; ln -sf libpthread-@@VERSION@@.so libpthread.so.0 ) +( cd lib ; rm -rf libc.so.6 ) +( cd lib ; ln -sf libc-@@VERSION@@.so libc.so.6 ) +( cd lib ; rm -rf librt.so.1 ) +( cd lib ; ln -sf librt-@@VERSION@@.so librt.so.1 ) +fi diff --git a/testing/source/glibc/doinst.sh-glibc b/testing/source/glibc/doinst.sh-glibc new file mode 100644 index 000000000..5fa7d2f86 --- /dev/null +++ b/testing/source/glibc/doinst.sh-glibc @@ -0,0 +1,162 @@ +#!/bin/sh +# Copyright (C) 2002, 2005 Slackware Linux, Inc. +# Copyright 2005, 2006, 2007, 2011, 2012, 2018 Patrick J. Volkerding, Sebeka, Minnesota, USA +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Swap glibc on the fly. +# +# If we're on a running system we have to handle this _very_ carefully. :-) +# The tricks involved here get trickier every time... + +# OK, now we have to be sure of a few things. First, you do have a 2.6 +# kernel running, right? + +if [ -r /proc/ksyms ]; then + echo "FATAL: you need to be running a 2.6.x kernel in order to upgrade" + echo "to this version of glibc." + echo + sleep 999 + exit 1 +fi + +# Next, stop using the /lib/ntpl libraries. These are now obsolete and +# will break the installation if present: +if [ -d lib/tls ]; then + mkdir -p lib/obsolete + mv lib/tls lib/obsolete +fi +if [ -x sbin/ldconfig ]; then + sbin/ldconfig -r . 2> /dev/null +fi + +# Install NPTL glibc libraries: +if [ -x /sbin/ldconfig -a -d lib/incoming ]; then # swap on the fly + # Try to protect with flock against another installpkg/removepkg running + # ldconfig while we're doing the on-the-fly install: + mkdir -p run/lock/pkgtools + ( flock 9 || exit 11 + # First create copies of the incoming libraries: + ( cd lib/incoming + for file in * ; do + if [ ! -r ../${file}.incoming ]; then + cp -a $file ../${file}.incoming + fi + done + ) + # Then switch to them all at once: + /sbin/ldconfig -l lib/*.incoming 2> /dev/null + # Remove old versions of the glibc libraries. If you really don't want to + # do this for some reason, create a file /etc/glibc-nowipe. + if [ ! -r etc/glibc-nowipe ]; then + ( cd lib + for INCOMING in incoming/*-* ; do + LIBPREFIX=$(basename $INCOMING | cut -f 1 -d -) + for LIBRARY in ${LIBPREFIX}-* ; do + # Don't remove the library if it ends in .incoming: + if [ "$(echo $LIBRARY | rev | cut -f 1 -d .)" = "gnimocni" ]; then + continue + fi + # Don't remove symlinks: + if [ -L $LIBRARY ]; then + continue + fi + rm -f $LIBRARY + done + done + # Remove stale versions of libcrypt from Slackware 14.2 or newer: + rm -f libcrypt-{2.23,2.24,2.25,2.26,2.27,2.28,2.29,2.30,2.31,2.32,2.33,2.34,2.35,2.36,2.37}.so + ) + fi + # Finally, rename them and clean up: + ( cd lib + for file in *.incoming ; do + rm -f `basename $file .incoming` + cp -a $file `basename $file .incoming` + /sbin/ldconfig -l `basename $file .incoming` 2> /dev/null + rm -f $file + done + ) + ) 9> run/lock/pkgtools/ldconfig.lock +else # no ldconfig? This is a broken situation, but we will do what we can: + ( cd lib/incoming + for file in * ; do + cp -a $file .. + done + ) +fi +# Now, get rid of the temporary directory: +rm -rf lib/incoming +# Done installing NPTL glibc libraries. + +# Handle config files: +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +config etc/nscd.conf.new +config etc/profile.d/glibc.csh.new +config etc/profile.d/glibc.sh.new +# Clearly you already decided this issue. :-) +rm -f etc/profile.d/glibc.csh.new +rm -f etc/profile.d/glibc.sh.new + +# This block below *should* be dead code, but it's probably safer to leave it +# here as a fallback. It no longer has complete coverage of all the links +# that would be needed in /lib${LIBDIRSUFFIX}, but it covers enough that if +# we did fall back on this the machine would boot until it reached the boot +# time call to ldconfig, which would then take care of any missing links. +# In case there's no ldconfig, make the links manually: +if [ ! -x /sbin/ldconfig ]; then +( cd lib ; rm -rf libm.so.6 ) +( cd lib ; ln -sf libm-@@VERSION@@.so libm.so.6 ) +( cd lib ; rm -rf libnss_files.so.2 ) +( cd lib ; ln -sf libnss_files-@@VERSION@@.so libnss_files.so.2 ) +( cd lib ; rm -rf libresolv.so.2 ) +( cd lib ; ln -sf libresolv-@@VERSION@@.so libresolv.so.2 ) +( cd lib ; rm -rf libutil.so.1 ) +( cd lib ; ln -sf libutil-@@VERSION@@.so libutil.so.1 ) +( cd lib ; rm -rf libnss_compat.so.2 ) +( cd lib ; ln -sf libnss_compat-@@VERSION@@.so libnss_compat.so.2 ) +( cd lib ; rm -rf libthread_db.so.1 ) +( cd lib ; ln -sf libthread_db-1.0.so libthread_db.so.1 ) +( cd lib ; rm -rf libnss_hesiod.so.2 ) +( cd lib ; ln -sf libnss_hesiod-@@VERSION@@.so libnss_hesiod.so.2 ) +( cd lib ; rm -rf libanl.so.1 ) +( cd lib ; ln -sf libanl-@@VERSION@@.so libanl.so.1 ) +( cd lib ; rm -rf libcrypt.so.1 ) +( cd lib ; ln -sf libcrypt1-@@VERSION@@.so libcrypt.so.1 ) +( cd lib ; rm -rf libcrypt.so.2 ) +( cd lib ; ln -sf libcrypt2-@@VERSION@@.so libcrypt.so.2 ) +( cd lib ; rm -rf libBrokenLocale.so.1 ) +( cd lib ; ln -sf libBrokenLocale-@@VERSION@@.so libBrokenLocale.so.1 ) +( cd lib ; rm -rf ld-linux.so.2 ) +( cd lib ; ln -sf ld-@@VERSION@@.so ld-linux.so.2 ) +( cd lib ; rm -rf libdl.so.2 ) +( cd lib ; ln -sf libdl-@@VERSION@@.so libdl.so.2 ) +( cd lib ; rm -rf libnss_dns.so.2 ) +( cd lib ; ln -sf libnss_dns-@@VERSION@@.so libnss_dns.so.2 ) +( cd lib ; rm -rf libpthread.so.0 ) +( cd lib ; ln -sf libpthread-@@VERSION@@.so libpthread.so.0 ) +( cd lib ; rm -rf libc.so.6 ) +( cd lib ; ln -sf libc-@@VERSION@@.so libc.so.6 ) +( cd lib ; rm -rf librt.so.1 ) +( cd lib ; ln -sf librt-@@VERSION@@.so librt.so.1 ) +fi + +# More links: diff --git a/testing/source/glibc/glibc-2.32.en_US.no.am.pm.date.format.diff b/testing/source/glibc/glibc-2.32.en_US.no.am.pm.date.format.diff new file mode 100644 index 000000000..5ca84bcac --- /dev/null +++ b/testing/source/glibc/glibc-2.32.en_US.no.am.pm.date.format.diff @@ -0,0 +1,14 @@ +--- ./localedata/locales/en_US.orig 2021-01-16 18:40:31.050990981 -0600 ++++ ./localedata/locales/en_US 2021-01-16 18:42:44.784983583 -0600 +@@ -121,7 +121,10 @@ + % different from d_t_fmt for historical reasons and has been different + % since 2000 when date_fmt was added as a GNU extension. At the end + % of 2018 it was adjusted to use 12H time (bug 24046) instead of 24H. +-date_fmt "%a %b %e %r %Z %Y" ++% [ Slackware editor's note - no thank you, US users ++% of UNIX-like systems expect a 24 hour clock, just ++% like users in the vast majority of other locales. ] ++%date_fmt "%a %d %b %Y %r %Z" + % + % Strings for AM/PM + % diff --git a/testing/source/glibc/glibc-cvs-checkout.sh b/testing/source/glibc/glibc-cvs-checkout.sh new file mode 100755 index 000000000..022d0117b --- /dev/null +++ b/testing/source/glibc/glibc-cvs-checkout.sh @@ -0,0 +1,3 @@ +echo "The password below is \"anoncvs\":" +cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc login +cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc co libc diff --git a/testing/source/glibc/glibc.SlackBuild b/testing/source/glibc/glibc.SlackBuild new file mode 100755 index 000000000..96dfe6598 --- /dev/null +++ b/testing/source/glibc/glibc.SlackBuild @@ -0,0 +1,512 @@ +#!/bin/bash + +# Copyright 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=glibc +VERSION=${VERSION:-$(echo glibc-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +CHECKOUT=${CHECKOUT:-""} +BUILD=${BUILD:-1} + +# I was considering disabling NSCD, but MoZes talked me out of it. :) +#DISABLE_NSCD=" --disable-nscd " + +# $ARCH may be preset, otherwise i586 compatibility with i686 binary +# structuring is the Slackware default. +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i586 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "glibc-$VERSION-$ARCH-$BUILD.txz" + echo "glibc-i18n-$VERSION-$ARCH-$BUILD.txz" + echo "glibc-profile-$VERSION-$ARCH-$BUILD.txz" + echo "aaa_glibc-solibs-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + +# Work around -Werror failure with gcc-10.2.0. +# NOTE: Until the next glibc release takes care of this issue, this will +# likely need to be updated with every new gcc release's version. Yes, we +# could pass --disable-werror by default, but I'd rather not just shove a +# stick in it like that. +if [ "$(gcc -dumpversion)" = "10.2.0" ]; then + if [ "$VERSION" = "2.30" ]; then + WERROR="--disable-werror" + fi +fi + +# I'll break this out as an option for fun :-) +case $ARCH in + i386) + OPTIMIZ="-O3 -march=i386 -mcpu=i686" + LIBDIRSUFFIX="" + ;; + i486) + OPTIMIZ="-O3 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" + ;; + i586) + OPTIMIZ="-O3 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" + ;; + i686) + OPTIMIZ="-O3 -march=i686" + LIBDIRSUFFIX="" + ;; + athlon) + OPTIMIZ="-O3 -march=athlon" + LIBDIRSUFFIX="" + ;; + s390) + OPTIMIZ="-O3" + LIBDIRSUFFIX="" + ;; + x86_64) + OPTIMIZ="-O3 -fPIC" + LIBDIRSUFFIX="64" + ;; + *) + OPTIMIZ="-O3" + LIBDIRSUFFIX="" + ;; +esac + +case $ARCH in + x86_64) + TARGET=${TARGET:-x86_64} + ;; + i586) + # This should be i586 for all 32-bit x86 arch: + TARGET=${TARGET:-i586} + ;; +esac + +# Hand off the $ARCH variable to $SLACKWARE_ARCH to avoid confusing glibc: +SLACKWARE_ARCH=$ARCH +unset ARCH + +CVSVER=${VERSION}${CHECKOUT} + +# NOTE!!! glibc needs to be built against the sanitized kernel headers, +# which will be installed under /usr/include by the kernel-headers package. +# Be sure the correct version of the headers package is installed BEFORE +# building glibc! + +TMP=${TMP:-/tmp} +mkdir -p $TMP + +# This function fixes a doinst.sh file for x86_64. +# With thanks to Fred Emmott. +fix_doinst() { + if [ "x$LIBDIRSUFFIX" = "x" ]; then + return; + fi; + # Fix "( cd usr/lib ;" occurrences + sed -i "s#lib ;#lib${LIBDIRSUFFIX} ;#" install/doinst.sh + # Fix "lib/" occurrences + sed -i "s#lib/#lib${LIBDIRSUFFIX}/#g" install/doinst.sh + # Fix "( cd lib" occurrences + sed -i "s#( cd lib\$#( cd lib${LIBDIRSUFFIX}#" install/doinst.sh + + if [ "$SLACKWARE_ARCH" = "x86_64" ]; then + sed -i 's#ld-linux.so.2#ld-linux-x86-64.so.2#' install/doinst.sh + fi +} + +# This is a patch function to put all glibc patches in the build script +# up near the top. +apply_patches() { + # Use old-style locale directories rather than a single (and strangely + # formatted) /usr/lib/locale/locale-archive file: + zcat $CWD/glibc.locale.no-archive.diff.gz | patch -p1 --verbose || exit 1 + # Support ru_RU.CP1251 locale: + zcat $CWD/glibc.ru_RU.CP1251.diff.gz | patch -p1 --verbose || exit 1 + # Don't use AM/PM format for date(1). That's just plain crazy. + zcat $CWD/glibc-2.32.en_US.no.am.pm.date.format.diff.gz | patch -p1 --verbose || exit 1 + # Other regression fixes from git: + for git_patch in $CWD/patches/*.patch.gz ; do + zcat $git_patch | patch -p1 --verbose || exit 1 + done +} + +# This is going to be the initial $DESTDIR: +export PKG=$TMP/package-glibc-incoming-tree +PGLIBC=$TMP/package-glibc +PSOLIBS=$TMP/package-aaa_glibc-solibs +PI18N=$TMP/package-glibc-i18n +PPROFILE=$TMP/package-glibc-profile +PDEBUG=$TMP/package-glibc-debug + +# Empty these locations first: +for dir in $PKG $PGLIBC $PSOLIBS $PZONE $PI18N $PPROFILE $PDEBUG ; do + if [ -d $dir ]; then + rm -rf $dir + fi + mkdir -p $dir +done +if [ -d $TMP/glibc-$VERSION ]; then + rm -rf $TMP/glibc-$VERSION +fi + +# Create an incoming directory structure for glibc to be built into: +mkdir -p $PKG/lib${LIBDIRSUFFIX} +mkdir -p $PKG/sbin +mkdir -p $PKG/usr/bin +mkdir -p $PKG/usr/lib${LIBDIRSUFFIX} +mkdir -p $PKG/usr/sbin +mkdir -p $PKG/usr/include +mkdir -p $PKG/usr/doc +mkdir -p $PKG/usr/man +mkdir -p $PKG/usr/share +mkdir -p $PKG/var/db/nscd +mkdir -p $PKG/var/run/nscd + +# Begin extract/compile: +cd $TMP +rm -rf glibc-$CVSVER +tar xvf $CWD/glibc-$CVSVER.tar.xz \ + || tar xvf $CWD/glibc-$CVSVER.tar.lz \ + || tar xvf $CWD/glibc-$CVSVER.tar.bz2 \ + || tar xvf $CWD/glibc-$CVSVER.tar.gz +cd glibc-$CVSVER + +# Apply patches; exit if any fail. +apply_patches +if [ ! $? = 0 ]; then + exit 1 +fi + +# Clean up leftover CVS directories: +find . -type d -name CVS -exec rm -r {} \+ 2> /dev/null + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +# Make build directory: +mkdir build-glibc-$VERSION +cd build-glibc-$VERSION || exit 1 + +echo "BUILDING DAS NPTL GLIBC" +# We are setting the variable below so that x86 ISA level is not included +# in shared libraries. Without this, glibc compiled with -march= may not +# run on some CPUs that it should be able to support. Needed for glibc-2.33. +# FIXME: revisit this with future glibc releases! +libc_cv_include_x86_isa_level=no \ +CFLAGS="-g $OPTIMIZ" \ +../configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --enable-kernel=4.4 \ + --with-headers=/usr/include \ + --enable-add-ons \ + --enable-profile \ + $DISABLE_NSCD \ + $WERROR \ + --infodir=/usr/info \ + --mandir=/usr/man \ + --with-tls \ + --with-__thread \ + --without-cvs \ + $TARGET-slackware-linux + +make $NUMJOBS || exit 1 +make $NUMJOBS install install_root=$PKG || exit 1 +# Don't use this, as it makes the i18n package WAY bigger: +#make localedata/install-locale-files DESTDIR=$PKG || exit 1 +# This is ugly run in parallel, and seems to hang at the end. But it actually +# completes much faster. :) +make $NUMJOBS localedata/install-locales install_root=$PKG DESTDIR=$PKG || exit 1 + +# Build and install libxcrypt: +pushd $CWD +ARCH=$SLACKWARE_ARCH LIBDIRSUFFIX=$LIBDIRSUFFIX SLKCFLAGS=$OPTIMIZ ./libxcrypt.build +popd + +# We've always had an sln symlink in /bin, so let's make sure it +# remains there so as not to break any scripts that might need it: +mkdir -p $PKG/bin +( cd $PKG/bin ; ln -sf /sbin/sln sln ) + +# This bit was mostly copped from Fedora Rawhide's .spec file. I'm not +# entirely sure how important it is, since I'm not aware of anything +# we ship trying to link libpthread as static. What it does is make sure +# that anything linking libpthread static includes all of the functions +# so that the resulting binary doesn't rely on parts of the library that +# were not linked in. Optimizing actually working over binary size, so +# to speak. +( cd $PKG/usr/lib${LIBDIRSUFFIX} + gcc -r -nostdlib -o libpthread.o -Wl,--whole-archive ./libpthread.a + rm libpthread.a + ar rcs libpthread.a libpthread.o + rm libpthread.o +) + +# The prevailing standard seems to be putting unstripped libraries in +# /usr/lib/debug/ and stripping the debugging symbols from all the other +# libraries. +mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/debug +cp -a $PKG/lib${LIBDIRSUFFIX}/l*.so* $PKG/usr/lib${LIBDIRSUFFIX}/debug +cp -a $PKG/usr/lib${LIBDIRSUFFIX}/*.a $PKG/usr/lib${LIBDIRSUFFIX}/debug +# Don't need debug+profile: +( cd $PKG/usr/lib${LIBDIRSUFFIX}/debug ; rm -f *_p.* ) +# NOTE: Is there really a reason for the glibc-debug package? +# If you're debugging glibc, you can also compile it, right? + +## COMMENTED OUT: There's no reason for profile libs to include -g information. +## Put back unstripped profiling libraries: +#mv $PKG/usr/lib${LIBDIRSUFFIX}/debug/*_p.a $PKG/usr/lib${LIBDIRSUFFIX} +# It might be best to put the unstripped and profiling libraries in glibc-debug and glibc-profile. + +# I don't think "strip -g" causes the pthread problems. It's --strip-unneeded that does. +strip -g $PKG/lib${LIBDIRSUFFIX}/l*.so* +strip -g $PKG/usr/lib${LIBDIRSUFFIX}/l*.so* +strip -g $PKG/usr/lib${LIBDIRSUFFIX}/lib*.a + +# Remove the rquota.x and rquota.h include files, as they are provided by +# the quota package: +rm -f $PKG/usr/include/rpcsvc/rquota.{h,x} + +# Back to the sources dir to add some files/docs: +cd $TMP/glibc-$CVSVER + +# We'll automatically install the config file for the Name Server Cache Daemon. +# Perhaps this should also have some commented-out startup code in rc.inet2... +mkdir -p $PKG/etc +cat nscd/nscd.conf > $PKG/etc/nscd.conf.new + +# Install docs: +( mkdir -p $PKG/usr/doc/glibc-$VERSION + cp -a \ + CONTRIBUTED-BY* COPYING* INSTALL* LICENSES* MAINTAINERS* NEWS* README* SECURITY* SHARED-FILES* \ + $PKG/usr/doc/glibc-$VERSION +) + +# Trim the NEWS file to omit ancient history: +if [ -r NEWS ]; then + DOCSDIR=$(echo $PKG/usr/doc/glibc-$VERSION) + cat NEWS | head -n 1000 > $DOCSDIR/NEWS + touch -r NEWS $DOCSDIR/NEWS +fi + +# OK, there are some very old Linux standards that say that any binaries in a /bin or +# /sbin directory (and the directories themselves) should be group bin rather than +# group root, unless a specific group is really needed for some reason. +# +# I can't find any mention of this in more recent standards docs, and always thought +# that it was pretty cosmetic anyway (hey, if there's a reason -- fill me in!), so +# it's possible that this ownership change won't be followed in the near future +# (it's a PITA, and causes many bug reports when the perms change is occasionally +# forgotten). +# +# But, it's hard to get me to break old habits, so we'll continue the tradition here: +# +# No, no we won't. You know how we love to break traditions. + +# Strip most binaries: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-debug 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip -g 2> /dev/null +) + +# Fix info dir: +rm $PKG/usr/info/dir +gzip -9 $PKG/usr/info/* + +# This is junk +rm $PKG/etc/ld.so.cache +( cd $PKG + find . -name "*.orig" -exec rm {} \+ +) + +################################## +# OK, time to make some packages # +################################## + +# glibc-profile: +cd $PPROFILE +mkdir -p usr/lib${LIBDIRSUFFIX} +# Might as well just grab these with 'mv' to simplify things later: +mv $PKG/usr/lib${LIBDIRSUFFIX}/lib*_p.a usr/lib${LIBDIRSUFFIX} +# Profile libs should be stripped. Use the debug libs to debug... +( cd usr/lib${LIBDIRSUFFIX} ; strip -g *.a ) +mkdir install +cp -a $CWD/slack-desc.glibc-profile install/slack-desc +makepkg -l y -c n $TMP/glibc-profile-$VERSION-$SLACKWARE_ARCH-$BUILD.txz + +# THIS IS NO LONGER PACKAGED (or is it? might be better to let it be made, and then ship it or not...) +# glibc-debug: +cd $PDEBUG +mkdir -p usr/lib${LIBDIRSUFFIX} +# Might as well just grab these with 'mv' to simplify things later: +mv $PKG/usr/lib${LIBDIRSUFFIX}/debug usr/lib${LIBDIRSUFFIX} +mkdir install +cp -a $CWD/slack-desc.glibc-debug install/slack-desc +## Don't package this: +#makepkg -l y -c n $TMP/glibc-debug-$VERSION-$SLACKWARE_ARCH-$BUILD.txz +## INSTEAD, NUKE THESE LIBS +#rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/debug + +# glibc-i18n: +cd $PI18N +mkdir -p usr/lib${LIBDIRSUFFIX}/locale +mv $PKG/usr/lib${LIBDIRSUFFIX}/locale/* usr/lib${LIBDIRSUFFIX}/locale +mkdir -p usr/share/{i18n,locale} +mv $PKG/usr/share/i18n/* usr/share/i18n +mv $PKG/usr/share/locale/* usr/share/locale +# Leave copies of the C, POSIX, and en_US locales in the main glibc package: +cp -a usr/lib${LIBDIRSUFFIX}/locale/{C,en_US}* $PKG/usr/lib${LIBDIRSUFFIX}/locale +mkdir -p $PKG/usr/share/i18n/locales +cp -a usr/share/i18n/locales/{C,POSIX,en_US} $PKG/usr/share/i18n/locales +mkdir install +cp -a $CWD/slack-desc.glibc-i18n install/slack-desc +makepkg -l y -c n $TMP/glibc-i18n-$VERSION-$SLACKWARE_ARCH-$BUILD.txz + +# aaa_glibc-solibs: +cd $PSOLIBS +mkdir -p etc/profile.d +cp -a $CWD/profile.d/* etc/profile.d +chown -R root:root etc +chmod 755 etc/profile.d/* +mkdir -p lib${LIBDIRSUFFIX} +cp -a $PKG/lib${LIBDIRSUFFIX}/* lib${LIBDIRSUFFIX} +( cd lib${LIBDIRSUFFIX} + mkdir incoming + mv *so* incoming + mv incoming/libmemusage.so . + # Beginning with glibc-2.34, shared objects are using their ABI sonames + # directly, which is frankly, a terrible idea. It might help other package + # managers, but doesn't do us any favors where we already had a system for + # dealing with upgrades (and downgrades!). We'll change these libraries to + # use the versioned naming system of glibc-2.33 and earlier so that we don't + # have to handle these files differently and so that it's easy to see what + # version of glibc is in use at a glance. + cd incoming + # First do the new libxcrypt links (a little bit differently): + for cryptlib in libcrypt.so.* ; do + CRYPTSO=$(echo $cryptlib | cut -f 3 -d .) + mv $cryptlib libcrypt${CRYPTSO}-${VERSION}.so + done + for library in *.so.* ; do + mv $library $(echo $library | cut -f 1 -d .)-${VERSION}.so + done + # This one is a special case. We don't want an $ARCH embedded in the + # filename. It prevents using the same install scripts on all $ARCH + # and does no good since we'll never have multiple $ARCH libraries + # installed in the same directory anyway. So give it the previous name + # format: + mv ld-linux*-${VERSION}.so ld-${VERSION}.so +) +mkdir -p usr +cp -a $PKG/usr/bin usr +mv usr/bin/ldd . +rm usr/bin/* +mv ldd usr/bin +mkdir -p usr/lib${LIBDIRSUFFIX} +# The gconv directory has a lot of stuff, but including it here will save some problems. +# Seems standard elsewhere. +cp -a $PKG/usr/lib${LIBDIRSUFFIX}/gconv usr/lib${LIBDIRSUFFIX} +mkdir -p usr/libexec +cp -a $PKG/usr/libexec/pt_chown usr/libexec +# Same usr.bin deal: +cp -a $PKG/sbin . +mv sbin/ldconfig . +rm sbin/* +mv ldconfig sbin +mkdir install +cp -a $CWD/slack-desc.aaa_glibc-solibs install/slack-desc +cp -a $CWD/doinst.sh-aaa_glibc-solibs install/doinst.sh +# Fix specific versioning for the symlink creation script. This part of the +# script would only be used in the case where there is no ldconfig on the +# running system that's used to install the package. That should never be the +# case, but we'll leave the code in place anyway just in case. +sed -i "s/@@VERSION@@/$VERSION/g" install/doinst.sh +# Call the function to fix doinst.sh where $LIBDIRSUFFIX is needed: +fix_doinst +# Only scrub the links in /lib{,64} that will be created by ldconfig: +find lib${LIBDIRSUFFIX} -type l -exec rm {} \+ +# Build the package: +makepkg -l y -c n $TMP/aaa_glibc-solibs-$VERSION-$SLACKWARE_ARCH-$BUILD.txz + +# And finally, the complete "all-in-one" glibc package is created +# from whatever was leftover: +cd $PGLIBC +mv $PKG/* . +mkdir -p etc/profile.d +cp -a $CWD/profile.d/* etc/profile.d +chown -R root:root etc +chmod 755 etc/profile.d/* +# Only scrub the links in /lib{,64} that will be created by ldconfig: +find lib${LIBDIRSUFFIX} -type l -exec rm {} \+ +mkdir install +cp -a $CWD/slack-desc.glibc install/slack-desc +cp -a $CWD/doinst.sh-glibc install/doinst.sh +# Call the function to fix doinst.sh where $LIBDIRSUFFIX is needed: +fix_doinst +( cd lib${LIBDIRSUFFIX} + mkdir incoming + mv *so* incoming + mv incoming/libmemusage.so . + #mv incoming/libcrypt* . + # Beginning with glibc-2.34, shared objects are using their ABI sonames + # directly, which is frankly, a terrible idea. It might help other package + # managers, but doesn't do us any favors where we already had a system for + # dealing with upgrades (and downgrades!). We'll change these libraries to + # use the versioned naming system of glibc-2.33 and earlier so that we don't + # have to handle these files differently and so that it's easy to see what + # version of glibc is in use at a glance. + cd incoming + # First do the new libxcrypt links (a little bit differently): + for cryptlib in libcrypt.so.* ; do + CRYPTSO=$(echo $cryptlib | cut -f 3 -d .) + mv $cryptlib libcrypt${CRYPTSO}-${VERSION}.so + done + for library in *.so.* ; do + mv $library $(echo $library | cut -f 1 -d .)-${VERSION}.so + done + # This one is a special case. We don't want an $ARCH embedded in the + # filename. It prevents using the same install scripts on all $ARCH + # and does no good since we'll never have multiple $ARCH libraries + # installed in the same directory anyway. So give it the previous name + # format: + mv ld-linux*-${VERSION}.so ld-${VERSION}.so +) +# Build the package: +/sbin/makepkg -l y -c n $TMP/glibc-$VERSION-$SLACKWARE_ARCH-$BUILD.txz + +# Done! +echo +echo "glibc packages built in $TMP!" diff --git a/testing/source/glibc/glibc.locale.no-archive.diff b/testing/source/glibc/glibc.locale.no-archive.diff new file mode 100644 index 000000000..173bafc72 --- /dev/null +++ b/testing/source/glibc/glibc.locale.no-archive.diff @@ -0,0 +1,10 @@ +--- ./localedata/Makefile.orig 2019-02-16 14:05:01.794154302 -0600 ++++ ./localedata/Makefile 2019-02-16 14:06:25.744146460 -0600 +@@ -413,6 +413,7 @@ + echo -n '...'; \ + input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \ + $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \ ++ --no-archive \ + -i locales/$$input -f charmaps/$$charset \ + $(addprefix --prefix=,$(install_root)) $$locale \ + && echo ' done'; diff --git a/testing/source/glibc/glibc.ru_RU.CP1251.diff b/testing/source/glibc/glibc.ru_RU.CP1251.diff new file mode 100644 index 000000000..376cf76a7 --- /dev/null +++ b/testing/source/glibc/glibc.ru_RU.CP1251.diff @@ -0,0 +1,10 @@ +--- ./localedata/SUPPORTED.orig 2005-07-17 20:50:35.000000000 -0500 ++++ ./localedata/SUPPORTED 2006-08-22 01:33:09.000000000 -0500 +@@ -270,6 +270,7 @@ + ro_RO/ISO-8859-2 \ + ru_RU.KOI8-R/KOI8-R \ + ru_RU.UTF-8/UTF-8 \ ++ru_RU.CP1251/CP1251 \ + ru_RU/ISO-8859-5 \ + ru_UA.UTF-8/UTF-8 \ + ru_UA/KOI8-U \ diff --git a/testing/source/glibc/libxcrypt.build b/testing/source/glibc/libxcrypt.build new file mode 100755 index 000000000..17bc62ec5 --- /dev/null +++ b/testing/source/glibc/libxcrypt.build @@ -0,0 +1,119 @@ +#!/bin/bash + +# Copyright 2023 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=libxcrypt +VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} + +TMP=${TMP:-/tmp} +PKG=$TMP/package-glibc-incoming-tree + +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1 +cd $PKGNAM-$VERSION || exit 1 + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +# Configure, build, and install: +if [ ! -r configure ]; then + if [ -x ./autogen.sh ]; then + NOCONFIGURE=1 ./autogen.sh + else + autoreconf -vif + fi +fi + +# First, build and install the compat library: +mkdir build-libxcrypt-compat +cd build-libxcrypt-compat +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +../configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --mandir=/usr/man \ + --enable-hashes=strong,glibc \ + --enable-obsolete-api=glibc \ + --disable-failure-tokens \ + --build=$ARCH-slackware-linux || exit 1 +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 +cd .. + +# Next, build the next-gen crypt library. We'll see what can link to it. :) +mkdir build-libxcrypt +cd build-libxcrypt +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +../configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --mandir=/usr/man \ + --enable-hashes=strong,glibc \ + --enable-obsolete-api=no \ + --disable-failure-tokens \ + --build=$ARCH-slackware-linux || exit 1 +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 +cd .. + +# Don't ship .la files: +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/libcrypt*.la + +# Strip binaries: +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +# Move libraries out of /usr: +mkdir -p $PKG/lib${LIBDIRSUFFIX} +( cd $PKG/usr/lib${LIBDIRSUFFIX} + ## Actually, glibc always had libcrypt.a, so... + ## No static crypt() libraries: + #rm libcrypt*.a + # No .so symlinks (yet): + rm libcrypt*.so + # Move libraries and remaining symlinks: + mv libcrypt*so* ../../lib${LIBDIRSUFFIX} + # Add .so symlinks for libcrypt and libxcrypt: + ln -sf ../../lib${LIBDIRSUFFIX}/libcrypt.so.2 libcrypt.so + ln -sf ../../lib${LIBDIRSUFFIX}/libcrypt.so.2 libxcrypt.so +) + +# Add a documentation directory: +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION +cp -a \ + AUTHORS* ChangeLog COPYING* LICENSING* NEWS* README* THANKS* TODO* \ + $PKG/usr/doc/${PKGNAM}-$VERSION + +# If there's a ChangeLog, installing at least part of the recent history +# is useful, but don't let it get totally out of control: +if [ -r ChangeLog ]; then + DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION) + cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog + touch -r ChangeLog $DOCSDIR/ChangeLog +fi diff --git a/testing/source/glibc/libxcrypt.url b/testing/source/glibc/libxcrypt.url new file mode 100644 index 000000000..4e0d180af --- /dev/null +++ b/testing/source/glibc/libxcrypt.url @@ -0,0 +1 @@ +https://github.com/besser82/libxcrypt diff --git a/testing/source/glibc/patches/glibc-2.38-upstream_fixes-1.patch b/testing/source/glibc/patches/glibc-2.38-upstream_fixes-1.patch new file mode 100644 index 000000000..e111d8aba --- /dev/null +++ b/testing/source/glibc/patches/glibc-2.38-upstream_fixes-1.patch @@ -0,0 +1,695 @@ +Submitted By: Xi Ruoyao <xry111 at xry111.site> +Date: 2023-09-13 +Initial Package Version: 2.38 +Upstream Status: Under review +Origin: Upstream & Self + - 1/5: https://sourceware.org/git/?p=glibc.git;a=patch;h=542b11058525 + - 2/5: https://sourceware.org/pipermail/libc-alpha/2023-August/150857.html + - 3/5: Trivial unused code removal + - 4/5: https://sourceware.org/pipermail/libc-alpha/2023-September/151522.html + - 5/5: https://sourceware.org/pipermail/libc-alpha/2023-September/151548.html +Description: Fixes a regression causing posix_memalign() + very slow in certain conditions to avoid + breaking ffmpeg-based applications; + fixes two security vulnerabilities, + CVE-2023-4527 and CVE-2023-4806. + +From fc01478d06658ace8d57e5328c1e717275acfe84 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Fri, 11 Aug 2023 11:18:17 +0200 +Subject: [PATCH 1/3] malloc: Enable merging of remainders in memalign (bug + 30723) + +Previously, calling _int_free from _int_memalign could put remainders +into the tcache or into fastbins, where they are invisible to the +low-level allocator. This results in missed merge opportunities +because once these freed chunks become available to the low-level +allocator, further memalign allocations (even of the same size are) +likely obstructing merges. + +Furthermore, during forwards merging in _int_memalign, do not +completely give up when the remainder is too small to serve as a +chunk on its own. We can still give it back if it can be merged +with the following unused chunk. This makes it more likely that +memalign calls in a loop achieve a compact memory layout, +independently of initial heap layout. + +Drop some useless (unsigned long) casts along the way, and tweak +the style to more closely match GNU on changed lines. + +Reviewed-by: DJ Delorie <dj@redhat.com> +(cherry picked from commit 542b1105852568c3ebc712225ae78b8c8ba31a78) +--- + malloc/malloc.c | 197 +++++++++++++++++++++++++++++------------------- + 1 file changed, 121 insertions(+), 76 deletions(-) + +diff --git a/malloc/malloc.c b/malloc/malloc.c +index e2f1a615a4..948f9759af 100644 +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -1086,6 +1086,11 @@ typedef struct malloc_chunk* mchunkptr; + + static void* _int_malloc(mstate, size_t); + static void _int_free(mstate, mchunkptr, int); ++static void _int_free_merge_chunk (mstate, mchunkptr, INTERNAL_SIZE_T); ++static INTERNAL_SIZE_T _int_free_create_chunk (mstate, ++ mchunkptr, INTERNAL_SIZE_T, ++ mchunkptr, INTERNAL_SIZE_T); ++static void _int_free_maybe_consolidate (mstate, INTERNAL_SIZE_T); + static void* _int_realloc(mstate, mchunkptr, INTERNAL_SIZE_T, + INTERNAL_SIZE_T); + static void* _int_memalign(mstate, size_t, size_t); +@@ -4637,31 +4642,52 @@ _int_free (mstate av, mchunkptr p, int have_lock) + if (!have_lock) + __libc_lock_lock (av->mutex); + +- nextchunk = chunk_at_offset(p, size); +- +- /* Lightweight tests: check whether the block is already the +- top block. */ +- if (__glibc_unlikely (p == av->top)) +- malloc_printerr ("double free or corruption (top)"); +- /* Or whether the next chunk is beyond the boundaries of the arena. */ +- if (__builtin_expect (contiguous (av) +- && (char *) nextchunk +- >= ((char *) av->top + chunksize(av->top)), 0)) +- malloc_printerr ("double free or corruption (out)"); +- /* Or whether the block is actually not marked used. */ +- if (__glibc_unlikely (!prev_inuse(nextchunk))) +- malloc_printerr ("double free or corruption (!prev)"); +- +- nextsize = chunksize(nextchunk); +- if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0) +- || __builtin_expect (nextsize >= av->system_mem, 0)) +- malloc_printerr ("free(): invalid next size (normal)"); ++ _int_free_merge_chunk (av, p, size); + +- free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ); ++ if (!have_lock) ++ __libc_lock_unlock (av->mutex); ++ } ++ /* ++ If the chunk was allocated via mmap, release via munmap(). ++ */ ++ ++ else { ++ munmap_chunk (p); ++ } ++} ++ ++/* Try to merge chunk P of SIZE bytes with its neighbors. Put the ++ resulting chunk on the appropriate bin list. P must not be on a ++ bin list yet, and it can be in use. */ ++static void ++_int_free_merge_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size) ++{ ++ mchunkptr nextchunk = chunk_at_offset(p, size); ++ ++ /* Lightweight tests: check whether the block is already the ++ top block. */ ++ if (__glibc_unlikely (p == av->top)) ++ malloc_printerr ("double free or corruption (top)"); ++ /* Or whether the next chunk is beyond the boundaries of the arena. */ ++ if (__builtin_expect (contiguous (av) ++ && (char *) nextchunk ++ >= ((char *) av->top + chunksize(av->top)), 0)) ++ malloc_printerr ("double free or corruption (out)"); ++ /* Or whether the block is actually not marked used. */ ++ if (__glibc_unlikely (!prev_inuse(nextchunk))) ++ malloc_printerr ("double free or corruption (!prev)"); ++ ++ INTERNAL_SIZE_T nextsize = chunksize(nextchunk); ++ if (__builtin_expect (chunksize_nomask (nextchunk) <= CHUNK_HDR_SZ, 0) ++ || __builtin_expect (nextsize >= av->system_mem, 0)) ++ malloc_printerr ("free(): invalid next size (normal)"); ++ ++ free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ); + +- /* consolidate backward */ +- if (!prev_inuse(p)) { +- prevsize = prev_size (p); ++ /* Consolidate backward. */ ++ if (!prev_inuse(p)) ++ { ++ INTERNAL_SIZE_T prevsize = prev_size (p); + size += prevsize; + p = chunk_at_offset(p, -((long) prevsize)); + if (__glibc_unlikely (chunksize(p) != prevsize)) +@@ -4669,9 +4695,25 @@ _int_free (mstate av, mchunkptr p, int have_lock) + unlink_chunk (av, p); + } + +- if (nextchunk != av->top) { ++ /* Write the chunk header, maybe after merging with the following chunk. */ ++ size = _int_free_create_chunk (av, p, size, nextchunk, nextsize); ++ _int_free_maybe_consolidate (av, size); ++} ++ ++/* Create a chunk at P of SIZE bytes, with SIZE potentially increased ++ to cover the immediately following chunk NEXTCHUNK of NEXTSIZE ++ bytes (if NEXTCHUNK is unused). The chunk at P is not actually ++ read and does not have to be initialized. After creation, it is ++ placed on the appropriate bin list. The function returns the size ++ of the new chunk. */ ++static INTERNAL_SIZE_T ++_int_free_create_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size, ++ mchunkptr nextchunk, INTERNAL_SIZE_T nextsize) ++{ ++ if (nextchunk != av->top) ++ { + /* get and clear inuse bit */ +- nextinuse = inuse_bit_at_offset(nextchunk, nextsize); ++ bool nextinuse = inuse_bit_at_offset (nextchunk, nextsize); + + /* consolidate forward */ + if (!nextinuse) { +@@ -4686,8 +4728,8 @@ _int_free (mstate av, mchunkptr p, int have_lock) + been given one chance to be used in malloc. + */ + +- bck = unsorted_chunks(av); +- fwd = bck->fd; ++ mchunkptr bck = unsorted_chunks (av); ++ mchunkptr fwd = bck->fd; + if (__glibc_unlikely (fwd->bk != bck)) + malloc_printerr ("free(): corrupted unsorted chunks"); + p->fd = fwd; +@@ -4706,61 +4748,52 @@ _int_free (mstate av, mchunkptr p, int have_lock) + check_free_chunk(av, p); + } + +- /* +- If the chunk borders the current high end of memory, +- consolidate into top +- */ +- +- else { ++ else ++ { ++ /* If the chunk borders the current high end of memory, ++ consolidate into top. */ + size += nextsize; + set_head(p, size | PREV_INUSE); + av->top = p; + check_chunk(av, p); + } + +- /* +- If freeing a large space, consolidate possibly-surrounding +- chunks. Then, if the total unused topmost memory exceeds trim +- threshold, ask malloc_trim to reduce top. +- +- Unless max_fast is 0, we don't know if there are fastbins +- bordering top, so we cannot tell for sure whether threshold +- has been reached unless fastbins are consolidated. But we +- don't want to consolidate on each free. As a compromise, +- consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD +- is reached. +- */ ++ return size; ++} + +- if ((unsigned long)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) { ++/* If freeing a large space, consolidate possibly-surrounding ++ chunks. Then, if the total unused topmost memory exceeds trim ++ threshold, ask malloc_trim to reduce top. */ ++static void ++_int_free_maybe_consolidate (mstate av, INTERNAL_SIZE_T size) ++{ ++ /* Unless max_fast is 0, we don't know if there are fastbins ++ bordering top, so we cannot tell for sure whether threshold has ++ been reached unless fastbins are consolidated. But we don't want ++ to consolidate on each free. As a compromise, consolidation is ++ performed if FASTBIN_CONSOLIDATION_THRESHOLD is reached. */ ++ if (size >= FASTBIN_CONSOLIDATION_THRESHOLD) ++ { + if (atomic_load_relaxed (&av->have_fastchunks)) + malloc_consolidate(av); + +- if (av == &main_arena) { ++ if (av == &main_arena) ++ { + #ifndef MORECORE_CANNOT_TRIM +- if ((unsigned long)(chunksize(av->top)) >= +- (unsigned long)(mp_.trim_threshold)) +- systrim(mp_.top_pad, av); ++ if (chunksize (av->top) >= mp_.trim_threshold) ++ systrim (mp_.top_pad, av); + #endif +- } else { +- /* Always try heap_trim(), even if the top chunk is not +- large, because the corresponding heap might go away. */ +- heap_info *heap = heap_for_ptr(top(av)); ++ } ++ else ++ { ++ /* Always try heap_trim, even if the top chunk is not large, ++ because the corresponding heap might go away. */ ++ heap_info *heap = heap_for_ptr (top (av)); + +- assert(heap->ar_ptr == av); +- heap_trim(heap, mp_.top_pad); +- } ++ assert (heap->ar_ptr == av); ++ heap_trim (heap, mp_.top_pad); ++ } + } +- +- if (!have_lock) +- __libc_lock_unlock (av->mutex); +- } +- /* +- If the chunk was allocated via mmap, release via munmap(). +- */ +- +- else { +- munmap_chunk (p); +- } + } + + /* +@@ -5221,7 +5254,7 @@ _int_memalign (mstate av, size_t alignment, size_t bytes) + (av != &main_arena ? NON_MAIN_ARENA : 0)); + set_inuse_bit_at_offset (newp, newsize); + set_head_size (p, leadsize | (av != &main_arena ? NON_MAIN_ARENA : 0)); +- _int_free (av, p, 1); ++ _int_free_merge_chunk (av, p, leadsize); + p = newp; + + assert (newsize >= nb && +@@ -5232,15 +5265,27 @@ _int_memalign (mstate av, size_t alignment, size_t bytes) + if (!chunk_is_mmapped (p)) + { + size = chunksize (p); +- if ((unsigned long) (size) > (unsigned long) (nb + MINSIZE)) ++ mchunkptr nextchunk = chunk_at_offset(p, size); ++ INTERNAL_SIZE_T nextsize = chunksize(nextchunk); ++ if (size > nb) + { + remainder_size = size - nb; +- remainder = chunk_at_offset (p, nb); +- set_head (remainder, remainder_size | PREV_INUSE | +- (av != &main_arena ? NON_MAIN_ARENA : 0)); +- set_head_size (p, nb); +- _int_free (av, remainder, 1); +- } ++ if (remainder_size >= MINSIZE ++ || nextchunk == av->top ++ || !inuse_bit_at_offset (nextchunk, nextsize)) ++ { ++ /* We can only give back the tail if it is larger than ++ MINSIZE, or if the following chunk is unused (top ++ chunk or unused in-heap chunk). Otherwise we would ++ create a chunk that is smaller than MINSIZE. */ ++ remainder = chunk_at_offset (p, nb); ++ set_head_size (p, nb); ++ remainder_size = _int_free_create_chunk (av, remainder, ++ remainder_size, ++ nextchunk, nextsize); ++ _int_free_maybe_consolidate (av, remainder_size); ++ } ++ } + } + + check_inuse_chunk (av, p); +-- +2.41.0 + +From b37e836b7cc2dba672e1de1cc7e076ba1c712614 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Fri, 11 Aug 2023 17:48:13 +0200 +Subject: [PATCH 2/3] malloc: Remove bin scanning from memalign (bug 30723) + +On the test workload (mpv --cache=yes with VP9 video decoding), the +bin scanning has a very poor success rate (less than 2%). The tcache +scanning has about 50% success rate, so keep that. + +Update comments in malloc/tst-memalign-2 to indicate the purpose +of the tests. Even with the scanning removed, the additional +merging opportunities since commit 542b1105852568c3ebc712225ae78b +("malloc: Enable merging of remainders in memalign (bug 30723)") +are sufficient to pass the existing large bins test. + +Link: https://sourceware.org/pipermail/libc-alpha/2023-August/150857.html +--- + malloc/malloc.c | 127 ++-------------------------------------- + malloc/tst-memalign-2.c | 7 ++- + 2 files changed, 10 insertions(+), 124 deletions(-) + +diff --git a/malloc/malloc.c b/malloc/malloc.c +index 948f9759af..9c2cab7a59 100644 +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -5082,7 +5082,6 @@ _int_memalign (mstate av, size_t alignment, size_t bytes) + mchunkptr remainder; /* spare room at end to split off */ + unsigned long remainder_size; /* its size */ + INTERNAL_SIZE_T size; +- mchunkptr victim; + + nb = checked_request2size (bytes); + if (nb == 0) +@@ -5101,129 +5100,13 @@ _int_memalign (mstate av, size_t alignment, size_t bytes) + we don't find anything in those bins, the common malloc code will + scan starting at 2x. */ + +- /* This will be set if we found a candidate chunk. */ +- victim = NULL; ++ /* Call malloc with worst case padding to hit alignment. */ ++ m = (char *) (_int_malloc (av, nb + alignment + MINSIZE)); + +- /* Fast bins are singly-linked, hard to remove a chunk from the middle +- and unlikely to meet our alignment requirements. We have not done +- any experimentation with searching for aligned fastbins. */ ++ if (m == 0) ++ return 0; /* propagate failure */ + +- if (av != NULL) +- { +- int first_bin_index; +- int first_largebin_index; +- int last_bin_index; +- +- if (in_smallbin_range (nb)) +- first_bin_index = smallbin_index (nb); +- else +- first_bin_index = largebin_index (nb); +- +- if (in_smallbin_range (nb * 2)) +- last_bin_index = smallbin_index (nb * 2); +- else +- last_bin_index = largebin_index (nb * 2); +- +- first_largebin_index = largebin_index (MIN_LARGE_SIZE); +- +- int victim_index; /* its bin index */ +- +- for (victim_index = first_bin_index; +- victim_index < last_bin_index; +- victim_index ++) +- { +- victim = NULL; +- +- if (victim_index < first_largebin_index) +- { +- /* Check small bins. Small bin chunks are doubly-linked despite +- being the same size. */ +- +- mchunkptr fwd; /* misc temp for linking */ +- mchunkptr bck; /* misc temp for linking */ +- +- bck = bin_at (av, victim_index); +- fwd = bck->fd; +- while (fwd != bck) +- { +- if (chunk_ok_for_memalign (fwd, alignment, nb) > 0) +- { +- victim = fwd; +- +- /* Unlink it */ +- victim->fd->bk = victim->bk; +- victim->bk->fd = victim->fd; +- break; +- } +- +- fwd = fwd->fd; +- } +- } +- else +- { +- /* Check large bins. */ +- mchunkptr fwd; /* misc temp for linking */ +- mchunkptr bck; /* misc temp for linking */ +- mchunkptr best = NULL; +- size_t best_size = 0; +- +- bck = bin_at (av, victim_index); +- fwd = bck->fd; +- +- while (fwd != bck) +- { +- int extra; +- +- if (chunksize (fwd) < nb) +- break; +- extra = chunk_ok_for_memalign (fwd, alignment, nb); +- if (extra > 0 +- && (extra <= best_size || best == NULL)) +- { +- best = fwd; +- best_size = extra; +- } +- +- fwd = fwd->fd; +- } +- victim = best; +- +- if (victim != NULL) +- { +- unlink_chunk (av, victim); +- break; +- } +- } +- +- if (victim != NULL) +- break; +- } +- } +- +- /* Strategy: find a spot within that chunk that meets the alignment +- request, and then possibly free the leading and trailing space. +- This strategy is incredibly costly and can lead to external +- fragmentation if header and footer chunks are unused. */ +- +- if (victim != NULL) +- { +- p = victim; +- m = chunk2mem (p); +- set_inuse (p); +- if (av != &main_arena) +- set_non_main_arena (p); +- } +- else +- { +- /* Call malloc with worst case padding to hit alignment. */ +- +- m = (char *) (_int_malloc (av, nb + alignment + MINSIZE)); +- +- if (m == 0) +- return 0; /* propagate failure */ +- +- p = mem2chunk (m); +- } ++ p = mem2chunk (m); + + if ((((unsigned long) (m)) % alignment) != 0) /* misaligned */ + { +diff --git a/malloc/tst-memalign-2.c b/malloc/tst-memalign-2.c +index f229283dbf..ecd6fa249e 100644 +--- a/malloc/tst-memalign-2.c ++++ b/malloc/tst-memalign-2.c +@@ -86,7 +86,8 @@ do_test (void) + TEST_VERIFY (tcache_allocs[i].ptr1 == tcache_allocs[i].ptr2); + } + +- /* Test for non-head tcache hits. */ ++ /* Test for non-head tcache hits. This exercises the memalign ++ scanning code to find matching allocations. */ + for (i = 0; i < array_length (ptr); ++ i) + { + if (i == 4) +@@ -113,7 +114,9 @@ do_test (void) + free (p); + TEST_VERIFY (count > 0); + +- /* Large bins test. */ ++ /* Large bins test. This verifies that the over-allocated parts ++ that memalign releases for future allocations can be reused by ++ memalign itself at least in some cases. */ + + for (i = 0; i < LN; ++ i) + { +-- +2.41.0 + +From 26973f7b09c33e67f6bcbc79371796c8dd334528 Mon Sep 17 00:00:00 2001 +From: Xi Ruoyao <xry111@xry111.site> +Date: Mon, 14 Aug 2023 11:05:18 +0800 +Subject: [PATCH 3/3] malloc: Remove unused functions and variables + +Remove unused chunk_ok_for_memalign function and unused local variables +in _int_free. + +Signed-off-by: Xi Ruoyao <xry111@xry111.site> +--- + malloc/malloc.c | 42 ------------------------------------------ + 1 file changed, 42 deletions(-) + +diff --git a/malloc/malloc.c b/malloc/malloc.c +index 9c2cab7a59..d0bbbf3710 100644 +--- a/malloc/malloc.c ++++ b/malloc/malloc.c +@@ -4488,12 +4488,6 @@ _int_free (mstate av, mchunkptr p, int have_lock) + { + INTERNAL_SIZE_T size; /* its size */ + mfastbinptr *fb; /* associated fastbin */ +- mchunkptr nextchunk; /* next contiguous chunk */ +- INTERNAL_SIZE_T nextsize; /* its size */ +- int nextinuse; /* true if nextchunk is used */ +- INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */ +- mchunkptr bck; /* misc temp for linking */ +- mchunkptr fwd; /* misc temp for linking */ + + size = chunksize (p); + +@@ -5032,42 +5026,6 @@ _int_realloc (mstate av, mchunkptr oldp, INTERNAL_SIZE_T oldsize, + ------------------------------ memalign ------------------------------ + */ + +-/* Returns 0 if the chunk is not and does not contain the requested +- aligned sub-chunk, else returns the amount of "waste" from +- trimming. NB is the *chunk* byte size, not the user byte +- size. */ +-static size_t +-chunk_ok_for_memalign (mchunkptr p, size_t alignment, size_t nb) +-{ +- void *m = chunk2mem (p); +- INTERNAL_SIZE_T size = chunksize (p); +- void *aligned_m = m; +- +- if (__glibc_unlikely (misaligned_chunk (p))) +- malloc_printerr ("_int_memalign(): unaligned chunk detected"); +- +- aligned_m = PTR_ALIGN_UP (m, alignment); +- +- INTERNAL_SIZE_T front_extra = (intptr_t) aligned_m - (intptr_t) m; +- +- /* We can't trim off the front as it's too small. */ +- if (front_extra > 0 && front_extra < MINSIZE) +- return 0; +- +- /* If it's a perfect fit, it's an exception to the return value rule +- (we would return zero waste, which looks like "not usable"), so +- handle it here by returning a small non-zero value instead. */ +- if (size == nb && front_extra == 0) +- return 1; +- +- /* If the block we need fits in the chunk, calculate total waste. */ +- if (size > nb + front_extra) +- return size - nb; +- +- /* Can't use this chunk. */ +- return 0; +-} +- + /* BYTES is user requested bytes, not requested chunksize bytes. */ + static void * + _int_memalign (mstate av, size_t alignment, size_t bytes) +-- +2.41.0 + +diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c +index c8b77bbc35..119dc9f00f 100644 +--- a/resolv/nss_dns/dns-host.c ++++ b/resolv/nss_dns/dns-host.c +@@ -427,7 +427,7 @@ _nss_dns_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, + { + n = __res_context_search (ctx, name, C_IN, T_A, + dns_packet_buffer, sizeof (dns_packet_buffer), +- NULL, NULL, NULL, NULL, NULL); ++ &alt_dns_packet_buffer, NULL, NULL, NULL, NULL); + if (n >= 0) + status = gaih_getanswer_noaaaa (alt_dns_packet_buffer, n, + &abuf, pat, errnop, herrnop, ttlp); + +diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c +index 6ae6744fe4..eb5ba59dac 100644 +--- a/sysdeps/posix/getaddrinfo.c ++++ b/sysdeps/posix/getaddrinfo.c +@@ -120,6 +120,7 @@ struct gaih_result + { + struct gaih_addrtuple *at; + char *canon; ++ char *hname; + bool free_at; + bool got_ipv6; + }; +@@ -165,6 +166,7 @@ gaih_result_reset (struct gaih_result *res) + if (res->free_at) + free (res->at); + free (res->canon); ++ free (res->hname); + memset (res, 0, sizeof (*res)); + } + +@@ -203,9 +205,8 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp, + return 0; + } + +-/* Convert struct hostent to a list of struct gaih_addrtuple objects. h_name +- is not copied, and the struct hostent object must not be deallocated +- prematurely. The new addresses are appended to the tuple array in RES. */ ++/* Convert struct hostent to a list of struct gaih_addrtuple objects. The new ++ addresses are appended to the tuple array in RES. */ + static bool + convert_hostent_to_gaih_addrtuple (const struct addrinfo *req, int family, + struct hostent *h, struct gaih_result *res) +@@ -238,6 +239,15 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req, int family, + res->at = array; + res->free_at = true; + ++ /* Duplicate h_name because it may get reclaimed when the underlying storage ++ is freed. */ ++ if (res->hname == NULL) ++ { ++ res->hname = __strdup (h->h_name); ++ if (res->hname == NULL) ++ return false; ++ } ++ + /* Update the next pointers on reallocation. */ + for (size_t i = 0; i < old; i++) + array[i].next = array + i + 1; +@@ -262,7 +272,6 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req, int family, + } + array[i].next = array + i + 1; + } +- array[0].name = h->h_name; + array[count - 1].next = NULL; + + return true; +@@ -324,15 +333,15 @@ gethosts (nss_gethostbyname3_r fct, int family, const char *name, + memory allocation failure. The returned string is allocated on the + heap; the caller has to free it. */ + static char * +-getcanonname (nss_action_list nip, struct gaih_addrtuple *at, const char *name) ++getcanonname (nss_action_list nip, const char *hname, const char *name) + { + nss_getcanonname_r *cfct = __nss_lookup_function (nip, "getcanonname_r"); + char *s = (char *) name; + if (cfct != NULL) + { + char buf[256]; +- if (DL_CALL_FCT (cfct, (at->name ?: name, buf, sizeof (buf), +- &s, &errno, &h_errno)) != NSS_STATUS_SUCCESS) ++ if (DL_CALL_FCT (cfct, (hname ?: name, buf, sizeof (buf), &s, &errno, ++ &h_errno)) != NSS_STATUS_SUCCESS) + /* If the canonical name cannot be determined, use the passed + string. */ + s = (char *) name; +@@ -740,6 +749,7 @@ get_nss_addresses (const char *name, const struct addrinfo *req, + } + no_inet6_data = no_data; + inet6_status = status; ++ + } + if (req->ai_family == AF_INET + || req->ai_family == AF_UNSPEC +@@ -771,7 +781,7 @@ get_nss_addresses (const char *name, const struct addrinfo *req, + if ((req->ai_flags & AI_CANONNAME) != 0 + && res->canon == NULL) + { +- char *canonbuf = getcanonname (nip, res->at, name); ++ char *canonbuf = getcanonname (nip, res->hname, name); + if (canonbuf == NULL) + { + __resolv_context_put (res_ctx); diff --git a/testing/source/glibc/patches/reenable_DT_HASH.patch b/testing/source/glibc/patches/reenable_DT_HASH.patch new file mode 100644 index 000000000..7b7fe9ee4 --- /dev/null +++ b/testing/source/glibc/patches/reenable_DT_HASH.patch @@ -0,0 +1,101 @@ +diff -up glibc-2.38/Makeconfig.45~ glibc-2.38/Makeconfig +--- glibc-2.38/Makeconfig.45~ 2023-08-01 01:02:58.246719027 +0200 ++++ glibc-2.38/Makeconfig 2023-08-01 01:02:58.303719582 +0200 +@@ -381,6 +381,15 @@ relro-LDFLAGS = -Wl,-z,relro + LDFLAGS.so += $(relro-LDFLAGS) + LDFLAGS-rtld += $(relro-LDFLAGS) + ++ifeq (yes,$(have-hash-style)) ++# For the time being we unconditionally use 'both'. At some time we ++# should declare statically linked code as 'out of luck' and compile ++# with --hash-style=gnu only. ++hashstyle-LDFLAGS = -Wl,--hash-style=both ++LDFLAGS.so += $(hashstyle-LDFLAGS) ++LDFLAGS-rtld += $(hashstyle-LDFLAGS) ++endif ++ + # Linker options to enable and disable DT_RELR. + ifeq ($(have-dt-relr),yes) + dt-relr-ldflag = -Wl,-z,pack-relative-relocs +diff -up glibc-2.38/Makerules.45~ glibc-2.38/Makerules +diff -up glibc-2.38/config.make.in.45~ glibc-2.38/config.make.in +--- glibc-2.38/config.make.in.45~ 2023-08-01 01:02:58.301719562 +0200 ++++ glibc-2.38/config.make.in 2023-08-01 01:03:54.721267748 +0200 +@@ -71,6 +71,7 @@ have-libaudit = @have_libaudit@ + have-libcap = @have_libcap@ + have-cc-with-libunwind = @libc_cv_cc_with_libunwind@ + bind-now = @bindnow@ ++have-hash-style = @libc_cv_hashstyle@ + have-cxx-thread_local = @libc_cv_cxx_thread_local@ + have-loop-to-function = @libc_cv_cc_loop_to_function@ + have-textrel_ifunc = @libc_cv_textrel_ifunc@ +diff -up glibc-2.38/configure.45~ glibc-2.38/configure +--- glibc-2.38/configure.45~ 2023-07-31 19:54:16.000000000 +0200 ++++ glibc-2.38/configure 2023-08-01 01:04:54.904850299 +0200 +@@ -655,6 +655,7 @@ libc_cv_cc_submachine + libc_cv_cc_nofma + libc_cv_mtls_dialect_gnu2 + libc_cv_has_glob_dat ++libc_cv_hashstyle + libc_cv_fpie + libc_cv_z_execstack + ASFLAGS_config +@@ -7107,6 +7108,32 @@ fi + printf "%s\n" "$libc_cv_fpie" >&6; } + + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --hash-style option" >&5 ++$as_echo_n "checking for --hash-style option... " >&6; } ++if ${libc_cv_hashstyle+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ cat > conftest.c <<EOF ++int _start (void) { return 42; } ++EOF ++if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp ++ -fPIC -shared -o conftest.so conftest.c ++ -Wl,--hash-style=both -nostdlib 1>&5' ++ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; } ++then ++ libc_cv_hashstyle=yes ++else ++ libc_cv_hashstyle=no ++fi ++rm -f conftest* ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hashstyle" >&5 ++$as_echo "$libc_cv_hashstyle" >&6; } ++ + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5 + printf %s "checking for GLOB_DAT reloc... " >&6; } +diff -up glibc-2.38/configure.ac.45~ glibc-2.38/configure.ac +--- glibc-2.38/configure.ac.45~ 2023-07-31 19:54:16.000000000 +0200 ++++ glibc-2.38/configure.ac 2023-08-01 01:02:58.303719582 +0200 +@@ -1339,6 +1339,22 @@ LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpi + + AC_SUBST(libc_cv_fpie) + ++AC_CACHE_CHECK(for --hash-style option, ++ libc_cv_hashstyle, [dnl ++cat > conftest.c <<EOF ++int _start (void) { return 42; } ++EOF ++if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp ++ -fPIC -shared -o conftest.so conftest.c ++ -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD]) ++then ++ libc_cv_hashstyle=yes ++else ++ libc_cv_hashstyle=no ++fi ++rm -f conftest*]) ++AC_SUBST(libc_cv_hashstyle) ++ + AC_CACHE_CHECK(for GLOB_DAT reloc, + libc_cv_has_glob_dat, [dnl + cat > conftest.c <<EOF diff --git a/testing/source/glibc/profile.d/glibc.csh.new b/testing/source/glibc/profile.d/glibc.csh.new new file mode 100755 index 000000000..1f33e9663 --- /dev/null +++ b/testing/source/glibc/profile.d/glibc.csh.new @@ -0,0 +1,9 @@ +#!/bin/csh +# Set more relaxed (glibc-2.3.5 like) malloc() checking. +# +# This relaxes the default paranoia level so that it reports +# bugs, but does not kill the questionable process. You can +# get away with running broken programs with this setting, +# but at a possible performance and security cost. +# +#setenv MALLOC_CHECK_ 1 diff --git a/testing/source/glibc/profile.d/glibc.sh.new b/testing/source/glibc/profile.d/glibc.sh.new new file mode 100755 index 000000000..979f4879e --- /dev/null +++ b/testing/source/glibc/profile.d/glibc.sh.new @@ -0,0 +1,8 @@ +#!/bin/sh +# Set more relaxed (glibc-2.3.5 like) malloc() checking. +# +# This relaxes the default paranoia level so that it reports +# bugs, but does not kill the questionable process. You can +# get away with running broken programs with this setting, +# but at a possible performance and security cost. +#export MALLOC_CHECK_=1 diff --git a/testing/source/glibc/slack-desc.aaa_glibc-solibs b/testing/source/glibc/slack-desc.aaa_glibc-solibs new file mode 100644 index 000000000..1604bace9 --- /dev/null +++ b/testing/source/glibc/slack-desc.aaa_glibc-solibs @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +aaa_glibc-solibs: aaa_glibc-solibs (shared GNU C libraries) +aaa_glibc-solibs: +aaa_glibc-solibs: This package contains the shared libraries, binaries, and support +aaa_glibc-solibs: files required to run most Linux applications linked with glibc. +aaa_glibc-solibs: +aaa_glibc-solibs: +aaa_glibc-solibs: +aaa_glibc-solibs: +aaa_glibc-solibs: +aaa_glibc-solibs: +aaa_glibc-solibs: diff --git a/testing/source/glibc/slack-desc.glibc b/testing/source/glibc/slack-desc.glibc new file mode 100644 index 000000000..63992d6b4 --- /dev/null +++ b/testing/source/glibc/slack-desc.glibc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +glibc: glibc (GNU C libraries) +glibc: +glibc: This package contains the GNU C libraries and header files. You'll +glibc: need this package to compile programs. +glibc: +glibc: The GNU C library was originally authored by Roland McGrath. +glibc: +glibc: Homepage: https://www.gnu.org/software/libc/ +glibc: +glibc: +glibc: diff --git a/testing/source/glibc/slack-desc.glibc-debug b/testing/source/glibc/slack-desc.glibc-debug new file mode 100644 index 000000000..8cb64d59a --- /dev/null +++ b/testing/source/glibc/slack-desc.glibc-debug @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +glibc-debug: glibc-debug (GNU C libraries with debugging symbols) +glibc-debug: +glibc-debug: This package contains versions of the GNU C libraries with debugging +glibc-debug: information. These are needed only if you wish to be able to step +glibc-debug: through C library routines while debugging programs. Most debugging +glibc-debug: efforts will not require these. +glibc-debug: To use these libraries, set LD_LIBRARY_PATH when calling the debugger: +glibc-debug: LD_LIBRARY_PATH=/usr/lib/debug gdb <executable> +glibc-debug: +glibc-debug: Or, use this approach if you need to debug a setuid binary: +glibc-debug: su user -c "LD_LIBRARY_PATH=/usr/lib/debug gdb <executable>" diff --git a/testing/source/glibc/slack-desc.glibc-i18n b/testing/source/glibc/slack-desc.glibc-i18n new file mode 100644 index 000000000..a697bc3db --- /dev/null +++ b/testing/source/glibc/slack-desc.glibc-i18n @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +glibc-i18n: glibc-i18n (locale files from glibc) +glibc-i18n: +glibc-i18n: These files go in /usr/lib/locale, /usr/share/i18n/, and +glibc-i18n: /usr/share/locale/ to provide internationalization support. +glibc-i18n: You'll need this package unless you will be using US English only. +glibc-i18n: +glibc-i18n: +glibc-i18n: +glibc-i18n: +glibc-i18n: +glibc-i18n: diff --git a/testing/source/glibc/slack-desc.glibc-profile b/testing/source/glibc/slack-desc.glibc-profile new file mode 100644 index 000000000..4b4100e08 --- /dev/null +++ b/testing/source/glibc/slack-desc.glibc-profile @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +glibc-profile: glibc-profile (GNU C libraries with profiling support) +glibc-profile: +glibc-profile: This package contains static versions of the GNU C libraries with +glibc-profile: support for profiling binaries using gprof. gprof calculates how +glibc-profile: much time a program spends in each routine which can suggest where +glibc-profile: to concentrate efforts to improve performance. +glibc-profile: +glibc-profile: See the gprof man page for more details. +glibc-profile: +glibc-profile: +glibc-profile: |