Source: glibc Version: 2.37-13 Tags: patch User: helm...@debian.org Usertags: dep17m2
Hi Aurelien, thanks for your answers on IRC to my design question. As promised here comes a patch that moves most files in binary packages built from glibc from aliased locations to /usr. This excludes the runtime dynamic linker for native libc packages (i.e. not multilib), because moving it would break filesystem bootstrap unless base-files installs the aliasing symlinks at the same time. That move is a later step and is what I asked for in https://lists.debian.org/20230912181509.ga2588...@subdivi.de. What I'm asking for here is staging the changes to glibc in two phases where the majority of the move happens before that coordinated upload. This patch is that majority move. Regarding the implementation, I asked whether you'd prefer to change slibdir or not and you answered that you'd rather not change it as e.g. Fedora is not changing it either. My first implementation changed slibdir and this second iteration that does not change slibdir is quite a bit simpler. I also asked about how to deal with symbolic links that point at aliased locations. Your answer felt a little inconclusive to me, but fixing them practically is a requirement: During filesystem bootstrap, libc6 needs to briefly operate in an unmerged state (temporarily until that coordinated move) and therefore those symlinks in libc6 cannot rely on the aliasing symlinks having been set up. Hence, I added code for fixing those links before letting dh_link perform their canonicalization according to Debian policy. In practice, this turns most of the links (but runtime dynamic linker links) into relative ones. We may be able to drop this after the coordinated move if you disagree about the approach taken here, but I think it is best to accept this temporarily at least. Are you also comfortable with keeping this link fixing permanently? The change at hand requires significant testing, because there is a significant risk of breaking stuff and doing so is very annoying to many developers. I've performed the following steps: * Reviewed the file lists of created .debs to see that all files but runtime dynamic linkers have moved out of aliased locations. * Reviewed all symbolic links in created .debs. * Ran piuparts. It complained about /lib32 and /libx32 not being cleaned up after removal of multilib packages. I think this is vaguely fine. Do you agree? If not, I can add postrm code that checks whether /usr/lib32 and /usr/libx32 vanished and removes the aliasing links in those cases. * I set up a custom reprepro repository with these packages and ran a number of filesystem bootstraps: * debootstrap * debootstrap --variant=minbase * cdebootstrap --flavour=standard * cdebootstrap --flavour=minimal * mmdebstrap --variant=debootstrap * mmdebstrap --variant=minbase * mmdebstrap --variant=apt All of these bootstraps do not contain any glibc-owned files in aliased locations with the exception of the runtime dynamic linker. * I compiled a minimal C program in chroot both with -m32 and without and verified that the embedded location of the runtime dynamic linker still is aliased and that the resulting program still runs. * In addition to testing on amd64, I performed a i386 build. I note that my builds are nocheck builds, due to failing tests unrelated to my changes. I did not bother figuring out what local configuration causes those the test failures. Do you miss any testing here? Helmut
diff --minimal -Nru glibc-2.37/debian/changelog glibc-2.37/debian/changelog --- glibc-2.37/debian/changelog 2023-12-03 14:23:52.000000000 +0100 +++ glibc-2.37/debian/changelog 2024-01-19 15:56:06.000000000 +0100 @@ -1,3 +1,10 @@ +glibc (2.37-13.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * DEP17: Move most files but rtld to /usr. (Closes: #-1) + + -- Helmut Grohne <hel...@subdivi.de> Fri, 19 Jan 2024 15:56:06 +0100 + glibc (2.37-13) unstable; urgency=medium [ Aurelien Jarno ] diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc-alt.install glibc-2.37/debian/debhelper.in/libc-alt.install --- glibc-2.37/debian/debhelper.in/libc-alt.install 2022-09-22 22:06:02.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc-alt.install 2024-01-19 15:56:06.000000000 +0100 @@ -1,6 +1,6 @@ # This file is used for biarch libraries. -TMPDIR/RTLDDIR/*.so* RTLDDIR -TMPDIR/SLIBDIR/*.so* SLIBDIR +TMPDIR/RTLDDIR/*.so* usr/RTLDDIR +TMPDIR/SLIBDIR/*.so* usr/SLIBDIR TMPDIR/LIBDIR/gconv/* LIBDIR/gconv/ TMPDIR/etc/ld.so.conf.d /etc diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc-alt.postrm glibc-2.37/debian/debhelper.in/libc-alt.postrm --- glibc-2.37/debian/debhelper.in/libc-alt.postrm 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc-alt.postrm 2024-01-19 15:56:06.000000000 +0100 @@ -7,8 +7,8 @@ # multiarch package are installed, then the multiarch package is removed, # and then the biarch package is removed, the dynamic linker symlink # becomes a dangling symlink. Remove it in that case. - if [ -h RTLDDIR/RTLD_SO ] && [ ! -f RTLDDIR/RTLD_SO ]; then - rm RTLDDIR/RTLD_SO + if [ -h usr/RTLDDIR/RTLD_SO ] && [ ! -f usr/RTLDDIR/RTLD_SO ]; then + rm usr/RTLDDIR/RTLD_SO fi fi diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc-bin.install glibc-2.37/debian/debhelper.in/libc-bin.install --- glibc-2.37/debian/debhelper.in/libc-bin.install 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc-bin.install 2024-01-19 15:56:06.000000000 +0100 @@ -4,7 +4,7 @@ debian/local/etc/nsswitch.conf usr/share/libc-bin debian/local/etc/nss etc/default posix/gai.conf etc -sbin/ldconfig sbin +sbin/ldconfig usr/sbin usr/bin/getconf usr/bin/getent usr/bin/iconv diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc-bin.lintian-overrides glibc-2.37/debian/debhelper.in/libc-bin.lintian-overrides --- glibc-2.37/debian/debhelper.in/libc-bin.lintian-overrides 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc-bin.lintian-overrides 2024-01-19 15:56:06.000000000 +0100 @@ -1,10 +1,10 @@ # ldconfig must be executable even when the libc is not configured, and # thus must be linked statically -statically-linked-binary sbin/ldconfig -shared-library-lacks-prerequisites [sbin/ldconfig] +statically-linked-binary usr/sbin/ldconfig +shared-library-lacks-prerequisites [usr/sbin/ldconfig] # these manpages are provided by the manpages package -no-manual-page [sbin/ldconfig] +no-manual-page [usr/sbin/ldconfig] no-manual-page [usr/bin/getent] no-manual-page [usr/bin/iconv] no-manual-page [usr/bin/ld.so] diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc-udeb.install glibc-2.37/debian/debhelper.in/libc-udeb.install --- glibc-2.37/debian/debhelper.in/libc-udeb.install 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc-udeb.install 2024-01-19 15:56:06.000000000 +0100 @@ -1,11 +1,11 @@ lib*/ld*.so* -lib/*/ld*.so* -lib/*/libm.so.* -lib/*/libmvec.so.* -lib/*/libdl.so.* -lib/*/libresolv.so.* -lib/*/libc.so.* -lib/*/librt.so.* -lib/*/libpthread.so.* -lib/*/libnss_dns.so.* -lib/*/libnss_files.so.* +lib/*/ld*.so* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libm.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libmvec.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libdl.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libresolv.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libc.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/librt.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libpthread.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libnss_dns.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libnss_files.so.* usr/lib/${DEB_HOST_MULTIARCH} diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc-udeb.install.hurd-i386 glibc-2.37/debian/debhelper.in/libc-udeb.install.hurd-i386 --- glibc-2.37/debian/debhelper.in/libc-udeb.install.hurd-i386 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc-udeb.install.hurd-i386 2024-01-19 15:56:06.000000000 +0100 @@ -1,14 +1,14 @@ lib*/ld*.so* -lib/*/ld*.so* -lib/*/libm.so.* -lib/*/libmvec.so.* -lib/*/libdl.so.* -lib/*/libresolv.so.* -lib/*/libc.so.* -lib/*/libutil.so.* -lib/*/librt.so.* -lib/*/libpthread.so.* -lib/*/libnss_dns.so.* -lib/*/libnss_files.so.* -lib/*/libmachuser.so.* -lib/*/libhurduser.so.* +lib/*/ld*.so* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libm.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libmvec.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libdl.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libresolv.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libc.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libutil.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/librt.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libpthread.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libnss_dns.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libnss_files.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libmachuser.so.* usr/lib/${DEB_HOST_MULTIARCH} +lib/*/libhurduser.so.* usr/lib/${DEB_HOST_MULTIARCH} diff --minimal -Nru glibc-2.37/debian/debhelper.in/libc.install glibc-2.37/debian/debhelper.in/libc.install --- glibc-2.37/debian/debhelper.in/libc.install 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/debhelper.in/libc.install 2024-01-19 15:56:06.000000000 +0100 @@ -1,4 +1,4 @@ etc/ld.so.conf.d lib*/ld*.so* -lib/*/*.so* +lib/*/*.so* usr/lib/${DEB_HOST_MULTIARCH} usr/lib/*/gconv diff --minimal -Nru glibc-2.37/debian/rules.d/debhelper.mk glibc-2.37/debian/rules.d/debhelper.mk --- glibc-2.37/debian/rules.d/debhelper.mk 2023-10-03 21:07:14.000000000 +0200 +++ glibc-2.37/debian/rules.d/debhelper.mk 2024-01-19 15:56:06.000000000 +0100 @@ -30,6 +30,14 @@ dh_installsystemd -p$(curpass) dh_installdocs -p$(curpass) dh_lintian -p $(curpass) + + # Ensure that symlinks resolve even when /usr is unmerged. + set -e; \ + find "debian/$(curpass)" \( -lname "*../lib*" -o -lname "/lib*" \) -printf "%p*%l\n" | \ + while IFS='*' read -r p l; do \ + ln -svf "$${l%%/lib*}/usr/lib$${l#*/lib}" "$$p"; \ + done + dh_link -p$(curpass) dh_bugfiles -p$(curpass) @@ -89,6 +97,14 @@ dh_installdirs -p$(curpass) dh_install -p$(curpass) dh_strip -p$(curpass) + + # Ensure that symlinks resolve even when /usr is unmerged. + set -e; \ + find "debian/$(curpass)" \( -lname "*../lib*" -o -lname "/lib*" \) -printf "%p*%l\n" | \ + while IFS='*' read -r p l; do \ + ln -svf "$${l%%/lib*}/usr/lib$${l#*/lib}" "$$p"; \ + done + dh_link -p$(curpass) # when you want to install extra packages, use extra_pkg_install.