archlinux-s390x/patches/pkgbuild/tar.sh

26 lines
1.3 KiB
Bash
Raw Normal View History

[FIX] selinux: the chroot named a host artefact, not a dependency The previous commit read the chroot's "coreutils needs libselinux.so.1" as a missing package. It is not one. Arch has no libselinux at all -- the clone 404s -- and Arch's coreutils declares no selinux dependency, because its build chroot has no selinux/selinux.h to find. Ours found one. Ubuntu carries libselinux1-dev, gnulib probes for the header unconditionally, and the audit names every victim: coreutils 13 binaries findutils find sed tar glibc makedb --without-selinux per package, which is what Arch gets for free. Arch ships neither chcon nor runcon either, so this converges with Arch rather than diverging. tar and find matter most: stage 2 runs makepkg inside this rootfs, and makepkg calls both. glibc is deliberately left alone. Nothing runs makedb, and rebuilding glibc would relink the foundation under sixty-nine other packages; stage 2 does it in a chroot where the header cannot be found. --- FR --- Le commit précédent a lu le « coreutils réclame libselinux.so.1 » du chroot comme un paquet manquant. Ce n'en est pas un. Arch n'a aucun libselinux — le clone rend un 404 — et son coreutils ne déclare aucune dépendance selinux, faute de selinux/selinux.h dans son chroot de construction. Le nôtre en a trouvé un. Ubuntu embarque libselinux1-dev, gnulib sonde l'en-tête sans condition, et l'audit nomme chaque victime : coreutils 13 binaires findutils find sed tar glibc makedb --without-selinux par paquet, ce qu'Arch obtient gratuitement. Arch ne livre ni chcon ni runcon non plus : on converge donc vers Arch au lieu de s'en écarter. tar et find sont les plus critiques — l'étage 2 lance makepkg dans ce rootfs, et makepkg les appelle tous deux. glibc est laissé tel quel, délibérément. Rien n'exécute makedb, et le reconstruire relierait la fondation sous soixante-neuf autres paquets ; l'étage 2 s'en charge dans un chroot où l'en-tête est introuvable. Assisted-by: Claude Opus 5
2026-08-17 01:33:41 -04:00
#!/usr/bin/env bash
# tar: --without-selinux. Same host artefact as coreutils.
#
# $ readelf -d repo/s390x/.../usr/bin/tar | grep NEEDED
# (NEEDED) Shared library: [libselinux.so.1]
#
# This is the one with the sharpest consequence. makepkg extracts every
# source with tar, so in stage 2 -- which runs makepkg inside the stage-1
# rootfs -- a tar that will not load stops the entire stage before its first
# package. Not cosmetic, and not something a later fix can route around.
#
# Arch's tar declares depends=(acl glibc). The full account of why the host
# supplies a header Arch's build chroot does not is in
# patches/pkgbuild/coreutils.sh.
#
# One ./configure in this PKGBUILD (verified), and it carries its own
# --sbindir/--libexecdir, so the anchor is the whole line rather than the
# bare form the other three match.
set -euo pipefail
grep -c -- '^ \./configure --prefix=/usr --sbindir=/usr/bin --libexecdir=/usr/lib/tar$' PKGBUILD | grep -qx 1 || {
echo "tar: expected exactly one ./configure line" >&2; exit 1; }
sed -i 's|^\(\s*\)\(\./configure --prefix=/usr --sbindir=/usr/bin --libexecdir=/usr/lib/tar\)$|\1\2 --without-selinux|' PKGBUILD
grep -c -- '--without-selinux' PKGBUILD | grep -qx 1 || {
echo "tar: --without-selinux not inserted exactly once" >&2; exit 1; }
echo "tar: --without-selinux (Arch has no libselinux; the host does)"