Use UsrMove path destination in the RPM files (RHEL-63048)

This commit updates most occurrences of /%{_lib} to %{_libdir}.
The glibc build process is not changed, instead the symbolic links
are created right before installing the files, to redirect them
to their final locations.  The symbolic links are removed again
so that they do not end up in the shipped packages.

Resolves: RHEL-63048
This commit is contained in:
Florian Weimer 2024-10-24 09:07:32 +02:00
parent bd128a5369
commit 9c5dbe51be

View File

@ -115,7 +115,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: %{glibcrelease}.6
Release: %{glibcrelease}.7
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -237,7 +237,7 @@ rpm.define("__find_debuginfo " .. wrapper .. " " .. sysroot .. " " .. original)
# If the architecture places the official ld.so name under /lib,
# but we use /lib64, we need to install both files.
%if "%{_lib}" == "lib64" && "%{dirname:%{glibc_ldso}}" == "/lib"
%global glibc_ldso_alternate /%{_lib}/%{basename:%{glibc_ldso}}
%global glibc_ldso_alternate %{_libdir}/%{basename:%{glibc_ldso}}
%endif
##############################################################################
@ -1250,6 +1250,20 @@ Patch1012: glibc-RHEL-49490-2.patch
##############################################################################
Obsoletes: glibc-profile < 2.4
Provides: ldconfig
Provides: /sbin/ldconfig
# Historic file paths provided for backwards compatibility.
Provides: %{glibc_ldso}
%if %{defined glibc_ldso_alternate}
Provides: %{glibc_ldso_alternate}
%endif
Provides: /%{_lib}/libanl.so.1
Provides: /%{_lib}/libc.so.6
Provides: /%{_lib}/libdl.so.2
Provides: /%{_lib}/libm.so.6
Provides: /%{_lib}/libpthread.so.0
Provides: /%{_lib}/libresolv.so.2
Provides: /%{_lib}/librt.so.1
Provides: /%{_lib}/libutil.so.1
# The dynamic linker supports DT_GNU_HASH
Provides: rtld(GNU_HASH)
@ -1968,11 +1982,19 @@ chmod 644 sysdeps/gnu/errlist.c
# Reload compiler and build options that were used during %%build.
GCC=`cat Gcc`
# Create symbolic links for UsrMove. See below: Remove UsrMove symbolic links.
usrmove_file_names="bin lib lib64 sbin"
for d in $usrmove_file_names ; do
mkdir -p "%{glibc_sysroot}/usr/$d"
ln -s "usr/$d" "%{glibc_sysroot}/$d"
done
%ifarch riscv64
# RISC-V ABI wants to install everything in /lib64/lp64d or /usr/lib64/lp64d.
# RISC-V ABI wants to install everything in /usr/lib64/lp64d.
# Make these be symlinks to /usr/lib64. See:
# Make these be symlinks to /lib64 or /usr/lib64 respectively. See:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/DRHT5YTPK4WWVGL3GIN5BF2IKX2ODHZ3/
for d in %{glibc_sysroot}%{_libdir} %{glibc_sysroot}/%{_lib}; do
for d in %{glibc_sysroot}%{_libdir}; do
mkdir -p $d
(cd $d && ln -sf . lp64d)
done
@ -2024,14 +2046,14 @@ install_different()
libbase=${lib#*/}
# Take care that `libbaseso' has a * that needs expanding so
# take care with quoting.
libbaseso=$(basename %{glibc_sysroot}/%{_lib}/${libbase}-*.so)
libbaseso=$(basename %{glibc_sysroot}%{_libdir}/${libbase}-*.so)
# Only install if different from default build library.
if cmp -s ${lib}.so ../build-%{target}/${lib}.so; then
ln -sf "$subdir_up"/$libbaseso $libdestdir/$libbaseso
else
cp -a ${lib}.so $libdestdir/$libbaseso
fi
dlib=$libdestdir/$(basename %{glibc_sysroot}/%{_lib}/${libbase}.so.*)
dlib=$libdestdir/$(basename %{glibc_sysroot}%{_libdir}/${libbase}.so.*)
ln -sf $libbaseso $dlib
done
}
@ -2050,11 +2072,10 @@ popd
# XXX: This looks like a bug in glibc that accidentally installed these
# wrong files. We probably don't need this today.
rm -f %{glibc_sysroot}/%{_libdir}/libNoVersion*
rm -f %{glibc_sysroot}/%{_lib}/libNoVersion*
# Remove the old nss modules.
rm -f %{glibc_sysroot}/%{_lib}/libnss1-*
rm -f %{glibc_sysroot}/%{_lib}/libnss-*.so.1
rm -f %{glibc_sysroot}%{_libdir}/libnss1-*
rm -f %{glibc_sysroot}%{_libdir}/libnss-*.so.1
# This statically linked binary is no longer necessary in a world where
# the default Fedora install uses an initramfs, and further we have rpm-ostree
@ -2170,8 +2191,8 @@ install -p -m 644 nss/nsswitch.conf %{glibc_sysroot}/etc/nsswitch.conf
install -m 644 nscd/nscd.conf %{glibc_sysroot}/etc
mkdir -p %{glibc_sysroot}%{_tmpfilesdir}
install -m 644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}
mkdir -p %{glibc_sysroot}/lib/systemd/system
install -m 644 nscd/nscd.service nscd/nscd.socket %{glibc_sysroot}/lib/systemd/system
mkdir -p %{glibc_sysroot}%{_prefix}/lib/systemd/system
install -m 644 nscd/nscd.service nscd/nscd.socket %{glibc_sysroot}%{_prefix}/lib/systemd/system
# Include ld.so.conf
echo 'include ld.so.conf.d/*.conf' > %{glibc_sysroot}/etc/ld.so.conf
@ -2225,7 +2246,7 @@ popd
%ifarch s390x
# Compatibility symlink
mkdir -p %{glibc_sysroot}/lib
ln -sf /%{_lib}/ld64.so.1 %{glibc_sysroot}/lib/ld64.so.1
ln -sf %{_libdir}/ld64.so.1 %{glibc_sysroot}/lib/ld64.so.1
%endif
%if %{with benchtests}
@ -2269,13 +2290,6 @@ mkdir -p %{glibc_sysroot}/var/{db,run}/nscd
touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services}
touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid}
# Move libpcprofile.so and libmemusage.so into the proper library directory.
# They can be moved without any real consequences because users would not use
# them directly.
mkdir -p %{glibc_sysroot}%{_libdir}
mv -f %{glibc_sysroot}/%{_lib}/lib{pcprofile,memusage}.so \
%{glibc_sysroot}%{_libdir}
# Strip all of the installed object files.
strip -g %{glibc_sysroot}%{_libdir}/*.o
@ -2288,7 +2302,7 @@ strip -g %{glibc_sysroot}%{_libdir}/*.o
# such that static linking works and produces the most minimally sized
# static application possible.
###############################################################################
pushd %{glibc_sysroot}%{_prefix}/%{_lib}/
pushd %{glibc_sysroot}%{_libdir}/
$GCC -r -nostdlib -o libpthread.o -Wl,--whole-archive ./libpthread.a
rm libpthread.a
ar rcs libpthread.a libpthread.o
@ -2314,7 +2328,14 @@ done
# that have old linker scripts that reference this file. We ship this only
# in compat-libpthread-nonshared sub-package.
##############################################################################
ar cr %{glibc_sysroot}%{_prefix}/%{_lib}/libpthread_nonshared.a
ar cr %{glibc_sysroot}%{_libdir}/libpthread_nonshared.a
# Remove UsrMove symbolic links.
# These should not end in the packaged contents.
# They are part of the filesystem package.
for d in $usrmove_file_names ; do
rm "%{glibc_sysroot}/$d"
done
##############################################################################
# Beyond this point in the install process we no longer modify the set of
@ -2458,15 +2479,15 @@ popd
echo ====================TESTING END=====================
PLTCMD='/^Relocation section .*\(\.rela\?\.plt\|\.rela\.IA_64\.pltoff\)/,/^$/p'
echo ====================PLT RELOCS LD.SO================
readelf -Wr %{glibc_sysroot}/%{_lib}/ld-*.so | sed -n -e "$PLTCMD"
readelf -Wr %{glibc_sysroot}%{_libdir}/ld-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS LIBC.SO==============
readelf -Wr %{glibc_sysroot}/%{_lib}/libc-*.so | sed -n -e "$PLTCMD"
readelf -Wr %{glibc_sysroot}%{_libdir}/libc-*.so | sed -n -e "$PLTCMD"
echo ====================PLT RELOCS END==================
# Obtain a way to run the dynamic loader. Avoid matching the symbolic
# link and then pick the first loader (although there should be only
# one).
run_ldso="$(find %{glibc_sysroot}/%{_lib}/ld-*.so -type f | LC_ALL=C sort | head -n1) --library-path %{glibc_sysroot}/%{_lib}"
run_ldso="$(find %{glibc_sysroot}%{_libdir}/ld-*.so -type f | LC_ALL=C sort | head -n1) --library-path %{glibc_sysroot}%{_libdir}"
# Show the auxiliary vector as seen by the new library
# (even if we do not perform the valgrind test).
@ -2678,48 +2699,48 @@ fi
%systemd_postun_with_restart nscd.service
%files -f glibc.filelist
/sbin/ldconfig
%{_sbindir}/ldconfig
%{_sbindir}/iconvconfig
%{_libexecdir}/getconf
%{glibc_ldso}
%{_prefix}%{glibc_ldso}
%{?glibc_ldso_alternate}
/%{_lib}/ld-%{version}.so
/%{_lib}/libBrokenLocale-%{version}.so
/%{_lib}/libBrokenLocale.so.1
/%{_lib}/libSegFault.so
/%{_lib}/libanl-%{version}.so
/%{_lib}/libanl.so.1
/%{_lib}/libc-%{version}.so
/%{_lib}/libc.so.6
/%{_lib}/libdl-%{version}.so
/%{_lib}/libdl.so.2
/%{_lib}/libm-%{version}.so
/%{_lib}/libm.so.6
/%{_lib}/libnss_compat-%{version}.so
/%{_lib}/libnss_compat.so.2
/%{_lib}/libnss_dns-%{version}.so
/%{_lib}/libnss_dns.so.2
/%{_lib}/libnss_files-%{version}.so
/%{_lib}/libnss_files.so.2
/%{_lib}/libpthread-%{version}.so
/%{_lib}/libpthread.so.0
/%{_lib}/libresolv-%{version}.so
/%{_lib}/libresolv.so.2
/%{_lib}/librt-%{version}.so
/%{_lib}/librt.so.1
/%{_lib}/libthread_db-1.0.so
/%{_lib}/libthread_db.so.1
/%{_lib}/libutil-%{version}.so
/%{_lib}/libutil.so.1
%{_libdir}/ld-%{version}.so
%{_libdir}/libBrokenLocale-%{version}.so
%{_libdir}/libBrokenLocale.so.1
%{_libdir}/libSegFault.so
%{_libdir}/libanl-%{version}.so
%{_libdir}/libanl.so.1
%{_libdir}/libc-%{version}.so
%{_libdir}/libc.so.6
%{_libdir}/libdl-%{version}.so
%{_libdir}/libdl.so.2
%{_libdir}/libm-%{version}.so
%{_libdir}/libm.so.6
%{_libdir}/libnss_compat-%{version}.so
%{_libdir}/libnss_compat.so.2
%{_libdir}/libnss_dns-%{version}.so
%{_libdir}/libnss_dns.so.2
%{_libdir}/libnss_files-%{version}.so
%{_libdir}/libnss_files.so.2
%{_libdir}/libpthread-%{version}.so
%{_libdir}/libpthread.so.0
%{_libdir}/libresolv-%{version}.so
%{_libdir}/libresolv.so.2
%{_libdir}/librt-%{version}.so
%{_libdir}/librt.so.1
%{_libdir}/libthread_db-1.0.so
%{_libdir}/libthread_db.so.1
%{_libdir}/libutil-%{version}.so
%{_libdir}/libutil.so.1
%{_libdir}/libmemusage.so
%{_libdir}/libpcprofile.so
%{_libdir}/audit
%if %{glibc_has_libmvec}
/%{_lib}/libmvec-%{version}.so
/%{_lib}/libmvec.so.1
%{_libdir}/libmvec-%{version}.so
%{_libdir}/libmvec.so.1
%endif
%if %{buildpower9}
/%{_lib}/glibc-hwcaps
%{_libdir}/glibc-hwcaps
%endif
%verify(not md5 size mtime link) %config(noreplace) /etc/nsswitch.conf
%verify(not md5 size mtime) %config(noreplace) /etc/ld.so.conf
@ -2839,8 +2860,8 @@ fi
%config(noreplace) /etc/nscd.conf
%dir %attr(0755,root,root) /var/run/nscd
%dir %attr(0755,root,root) /var/db/nscd
/lib/systemd/system/nscd.service
/lib/systemd/system/nscd.socket
%{_prefix}/lib/systemd/system/nscd.service
%{_prefix}/lib/systemd/system/nscd.socket
%{_tmpfilesdir}/nscd.conf
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid
%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket
@ -2855,12 +2876,12 @@ fi
%ghost %config(missingok,noreplace) /etc/sysconfig/nscd
%files -n nss_db
/%{_lib}/libnss_db-%{version}.so
/%{_lib}/libnss_db.so.2
%{_libdir}/libnss_db-%{version}.so
%{_libdir}/libnss_db.so.2
/var/db/Makefile
%files -n nss_hesiod
/%{_lib}/libnss_hesiod-%{version}.so
/%{_lib}/libnss_hesiod.so.2
%{_libdir}/libnss_hesiod-%{version}.so
%{_libdir}/libnss_hesiod.so.2
%doc hesiod/README.hesiod
%files nss-devel
%{_libdir}/libnss_compat.so
@ -2870,8 +2891,8 @@ fi
%{_libdir}/libnss_hesiod.so
%files -n libnsl
/%{_lib}/libnsl-%{version}.so
/%{_lib}/libnsl.so.1
%{_libdir}/libnsl-%{version}.so
%{_libdir}/libnsl.so.1
%if %{with benchtests}
%files benchtests
@ -2882,6 +2903,9 @@ fi
%{_libdir}/libpthread_nonshared.a
%changelog
* Wed Oct 23 2024 Florian Weimer <fweimer@redhat.com> - 2.28-251.7
- Use UsrMove path destination in the RPM files (RHEL-63048)
* Tue Sep 17 2024 Patsy Griffin <patsy@redhat.com> - 2.28-251.6
- s390x: Fix segfault in wcsncmp
- Enhanced test coverage for strncmp, wcsncmp (RHEL-49490)