From 9936d8f8734bf0c1c9d7c453dc7e163a2cfa4fd0 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Fri, 21 Aug 2026 16:53:49 -0400 Subject: [PATCH] [FIX] binutils: delete the option, do not comment it out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PGO fix broke the build it was meant to repair: /build/binutils/PKGBUILD: line 107: --enable-plugins: command not found The line it commented out ended in a backslash. A comment inside a backslash-continued command does not comment out an option -- it breaks the continuation, and the next option becomes a command of its own. This port had already documented the mirror image, where commenting the FIRST line of a multi-line assignment leaves the continuations live; same fact, other side. The line is deleted now, and nothing is put in its place: any comment inside the ./configure invocation would break it again. The explanation belongs in the hook. Also removed from that hook: a check ending in `|| true`, which passes always. A guard that cannot fail is worse than no guard, because it reads like verification. --- FR --- Le correctif PGO a cassé la construction qu'il devait réparer : /build/binutils/PKGBUILD: line 107: --enable-plugins: command not found La ligne commentée finissait par une contre-oblique. Un commentaire dans une commande continuée ne supprime pas une option — il brise la continuation, et l'option suivante devient une commande. Ce portage avait déjà documenté l'image inverse, où commenter la PREMIÈRE ligne d'une affectation multiligne laisse les continuations actives ; même fait, autre face. La ligne est désormais supprimée, et rien ne la remplace : tout commentaire dans l'appel à ./configure le briserait de nouveau. L'explication appartient au hook. Retiré aussi de ce hook : un contrôle finissant par `|| true`, donc toujours satisfait. Une garde incapable d'échouer est pire qu'aucune garde, car elle se lit comme une vérification. Assisted-by: Claude Opus 5 --- patches/pkgbuild/binutils.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/patches/pkgbuild/binutils.sh b/patches/pkgbuild/binutils.sh index 454df82..661e155 100755 --- a/patches/pkgbuild/binutils.sh +++ b/patches/pkgbuild/binutils.sh @@ -69,20 +69,31 @@ echo "binutils: libdir pinned to /usr/lib (keeps /usr/lib64 a symlink)" # five percent faster; PGO also roughly triples the build, which this port pays # for on every stage. python3 - <<'ZZPY' -import io, re +import io +# DELETED, not commented. +# +# The first version replaced the line with a comment, and binutils then failed +# with +# +# /build/binutils/PKGBUILD: line 107: --enable-plugins: command not found +# +# because the line ended in a backslash. A comment inside a continued command +# does not comment out an option -- it breaks the continuation, and the NEXT +# option becomes a command of its own. The documented trap in this port was the +# mirror image (commenting the first line of a multi-line assignment leaves the +# continuations live); this is the same fact from the other side. +# +# Nothing is left in its place: the explanation belongs in this hook, and any +# comment placed inside the configure invocation would break it again. lines = io.open("PKGBUILD", encoding="utf-8").read().split("\n") hit = [i for i, l in enumerate(lines) if "--enable-pgo-build" in l] assert len(hit) == 1, "binutils: expected one --enable-pgo-build line, got %d" % len(hit) i = hit[0] assert lines[i].strip().startswith("--enable-pgo-build"), \ "binutils: --enable-pgo-build shares its line: %r" % lines[i] -ind = re.match(r"^[ \t]*", lines[i]).group(0) -lines[i] = ind + "# --enable-pgo-build=lto removed: gold's templates do not survive" -lines.insert(i + 1, ind + "# LTO here, and PGO is build-time only -- no feature is lost.") +del lines[i] io.open("PKGBUILD", "w", encoding="utf-8").write("\n".join(lines)) ZZPY -grep -q "enable-pgo-build=lto removed" PKGBUILD || { - echo "binutils: the PGO line was not commented" >&2; exit 1; } grep -qE "^[[:space:]]*--enable-pgo-build" PKGBUILD && { echo "binutils: an active --enable-pgo-build line survived" >&2; exit 1; } echo "binutils: PGO+LTO build dropped"