Skip to content

gawk, gawk-bootstrap: stop installing the same paths (#973) - #1560

Draft
bryan-minimal wants to merge 1 commit into
mainfrom
gawk-bootstrap-disjoint
Draft

bryan-minimal wants to merge 1 commit into
mainfrom
gawk-bootstrap-disjoint

Conversation

@bryan-minimal

Copy link
Copy Markdown
Member

Fixes #973.

What changes

package before after
gawk-bootstrap full gawk 5.4.1 tree under /usr (82 files) only usr/bin/awk, a real binary (install -D gawk usr/bin/awk, not upstream's awk -> gawk symlink)
gawk full tree, including the usr/bin/awk -> gawk symlink full tree minus usr/bin/awk. It gains gawk-bootstrap in runtime_deps, which supplies awk

The two packages now share no path. A box that holds both, such as any build or test sandbox with base-bootstrap plus gawk, gets one copy of each file, so the result no longer depends on which store entry was linked first. Under registry-model.md §12 (gominimal/arch#183) the pair no longer conflicts.

A new standalone test, gawk.awk_smoketest (/bin/awk --version), checks that gawk still provides awk through its runtime dep.

What the two packages actually ship (cached amd64 artifacts)

I compared the cached artifacts from gs://minimal-staging-cache: gawk-bootstrap with spec 6802ed7b…, artifact acbd19be…, and gawk with spec 8f286b40…, artifact 2d059102….

  • The path sets are identical: 135 tar entries and 82 files each.
  • Only usr/bin/gawk and usr/bin/gawk-5.4.1 differ in content. The readline build is 1,384,408 bytes and the bootstrap build is 1,374,320 bytes. The extension .sos, libexec/awk/{grcat,pwcat}, headers, man pages and locales are byte-identical.
  • usr/bin/awk is a symlink to gawk in both packages. So in a mixed box, whichever gawk is linked first decides what awk runs.

Who consumes gawk-bootstrap, and how they run awk

grep -l gawk-bootstrap/build.ncl packages/*/build.ncl lists 19 packages:

  • base-bootstrap (runtime_deps). This is the edge that matters: it puts gawk-bootstrap into every build sandbox in the repo.
  • build_deps of 18 early-graph packages: acl, attr, bash-bootstrap, binutils, coreutils, diffutils, file, findutils, gcc, gmp, grep, libarchive, make, mpc, mpfr, pcre2, perl, sed. All except libarchive and perl have a replace_on_cycle gen-13 prebuilt breaker.
  • test_deps: coreutils.wc, which runs bare awk '{print $1}'.

How they use it: none of these recipes' build.sh names awk or gawk. They reach awk only through upstream autotools and Makefiles, which take $AWK from AC_PROG_AWK. That macro probes gawk mawk nawk awk on PATH, so after this change it finds awk, which is the same gawk 5.4.1 binary. Across all of packages/*/build.sh there is one explicit gawk call, in wget's CVE test, and wget depends on base, which brings in the real gawk. Nothing uses /usr/bin/awk as an absolute path.

gawk consumers (8): base, check, xdg-utils (runtime); bash, glibc, redis (build); chromedriver-bin and ngspice (test_deps, both run bare awk). All of them still get both gawk and awk.

Why this layout and not the others

awk must stay on PATH in every build sandbox, and the only package that can provide it there is gawk-bootstrap: base-bootstrap cannot depend on the real gawk, because gawk builds with base-bootstrap (a cycle). The sandbox has no per-package PATH or env hook, so the awk has to sit at /usr/bin/awk. Exactly one package can own that path, so it goes to gawk-bootstrap, and gawk-bootstrap ships nothing else.

  • Private prefix only (issue option 1 as written, with no /usr/bin/awk) would take awk away from every build sandbox. This would break most autotools builds at configure time or, worse, when config.status runs.
  • Subset in consumers' runtime_deps (option 2) doesn't apply: the main edge is base-bootstrap's whole-package runtime dep. Session boxes also link the whole package regardless of subsetOf (min 0.8).
  • Keep gawk-bootstrap out of test sandboxes (option 3) leaves the build-sandbox overlap in place: glibc, bash and redis build with both packages.
  • Switch consumers to the real gawk: a cycle rules this out for base-bootstrap and for the 16 consumers that carry breakers. libarchive and perl could switch, but nothing would change, because base-bootstrap still puts gawk-bootstrap into their sandboxes. So switching consumers can't remove the overlap. Only changing what the two packages ship can.

The new gawk -> gawk-bootstrap runtime edge adds no new cycle. gawk-bootstrap's closure already reaches gawk through glibc (glibc builds with gawk), and that cycle is already broken by glibc's bedrock breaker.

Trade-offs and risks

  • World rebuild. gawk-bootstrap's spec hash changes, and with it base-bootstrap's, so every package's build hash changes. This is unavoidable for any fix that touches gawk-bootstrap. Expect a full world rebuild in build-bot and one merge-queue window.
  • gawk is no longer a name in bootstrap-only build sandboxes. An upstream build that calls gawk by name (rather than $AWK or awk) and doesn't import gawk will now fail with gawk: command not found. No recipe here does that, but upstream Makefiles can't all be audited from this repo, so the world rebuild is the real test. The fix for any hit is to add gawk to that package's build_deps, as redis did in redis: declare gawk build dep (fixes 'awk: command not found') #542.
  • Bootstrap-only sandboxes lose gawk's extension .sos, usr/share/awk library scripts and locales. That matters only for builds that use @load/-l, or @include/-i, with a bundled library. None was found.
  • awk (not gawk) is now the non-readline build wherever the real gawk is installed. The only difference is line editing in the interactive debugger (awk -D). gawk itself is still the readline build.
  • The gawk-bootstrap (prebuilt) breaker is unchanged. It still ships the old full usr/** layout. It only stands in for gawk-bootstrap inside gawk-bootstrap's own cycle, where the real gawk is not present, so it doesn't reintroduce the overlap. Re-cutting it in gominimal/bootstrap is a separate, optional step.

🤖 Generated with Claude Code

gawk-bootstrap now ships only usr/bin/awk (a real binary, not upstream's
awk -> gawk symlink). gawk ships every other gawk path, drops its own awk
symlink, and takes awk from gawk-bootstrap through runtime_deps. The two
packages no longer share any path, so a box holding both (any test or build
sandbox with base-bootstrap plus gawk) gets one deterministic copy of each
file instead of ~800 "Not linking ... already exists" warnings.

base-bootstrap keeps an `awk` on PATH for every build; gawk's consumers
(base, xdg-utils, check, tests) keep both `gawk` and `awk`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gawk and gawk-bootstrap install the same paths: ~800 sandbox collisions per run, test sandboxes get a nondeterministic gawk

1 participant