What an in-place patch forces EESSI to rebuild

Goal: the patched easyconfigs keep their filenames and versions. Report which installed modules must be rebuilt, which need a review, and which link the patched package as a shared library. The set is the rebuild closure: every installed module that depends on the patched one within its toolchain generation, and no module from another generation.

Run it on the fixture

eb-stack rebuild-set \
  --changed tests/rebuild_set_fixtures/changed.txt \
  --easystack tests/rebuild_set_fixtures/eessi-2026.06-eb-5.4.0-2026.1.yml \
  --easystack tests/rebuild_set_fixtures/20261001-eb-5.4.1-zlib.yml \
  --easyconfigs tests/rebuild_set_fixtures/release \
  --easyblocks tests/rebuild_set_fixtures/easyblocks \
  --installed tests/rebuild_set_fixtures/installed.txt \
  --installed-modulerc tests/rebuild_set_fixtures/modules/all \
  --installed-label x86_64/amd/zen4 \
  --generated-at 2026-10-22T12:00:00Z \
  --out-dir /tmp/rebuild-out

The command prints:

changed=2 rows=8 must-rebuild=2 review=2 no-rebuild=4 missing=1 easystacks=2 skipped_easyconfigs=0 out=/tmp/rebuild-out

rebuild-set.md ends with the reach class of each changed easyconfig. cross-user and network-facing justify a backport. local-only and not-reachable do not. unclassified means neither the built-in names nor a --reachability file names the package. zlib and Absent-1.0.eb on this fixture are unclassified.

Run it on a mounted stack

From a clone of EESSI/software-layer, with the 2026.06 stack mounted. EB_EASYCONFIGS and EB_EASYBLOCKS come from scripts/fetch-upstream-trees.sh:

scripts/fetch-upstream-trees.sh
set -a
source "${EB_UPSTREAM_CACHE:-$HOME/.cache/eb-stack/upstream}/env.sh"
set +a
eb-stack rebuild-set \
  --changed changed.txt \
  --easystack easystacks/software.eessi.io/2026.06/*.yml \
  --easystack easystacks/software.eessi.io/2026.06/rebuilds/*.yml \
  $(for d in commit-trees/*/; do printf -- '--commit-tree %s=%s ' "$(basename "$d")" "$d"; done) \
  --easyconfigs "$EB_EASYCONFIGS" \
  --easyblocks "$EB_EASYBLOCKS" \
  --installed installed.txt \
  --installed-modulerc "$EESSI_SOFTWARE_PATH/modules/all" \
  --filter-deps "$EASYBUILD_FILTER_DEPS" \
  --installed-label x86_64/amd/zen4 \
  --generated-at 2026-10-22T12:00:00Z \
  --out-dir /tmp/rebuild-out

--commit-tree NAME=DIR resolves a from-commit pin, the same way as pr-overlap. --filter-deps drops dependency tuples before the walk. When the flag is omitted and EASYBUILD_FILTER_DEPS is set, the command reads the variable. --prefix is an install prefix: for each patched module the command reads software/<name>/<version>/lib*/*.a there. --check-static needs --prefix.

--changed is an easyconfig filename, repeated, or a file that is not an .eb: one filename per line, blank lines and # comments skipped. --easystack is each deployed easystack. A from-commit pin is resolved with --commit-tree, the same way as pr-overlap. Pass the CPU easystacks for the target you are asking about, and leave out accel/ and additional_arch/ unless that is the stack you mounted.

--easyconfigs is the easyconfigs tree of the EasyBuild release the stack uses. --filter-deps drops dependency tuples before the walk, with the same matching as pr-overlap. It does not remove an extension from a bundle’s exts_list. When the flag is omitted and EASYBUILD_FILTER_DEPS is set, the command reads the variable. --installed-modulerc is that prefix’s modules/all. --easyblocks is the EasyBuild release’s easybuild/easyblocks package. A missing class is recorded. The module stays in the set, because it is already installed.

Rank scanner findings by rebuild cost

A scanner export names the modules that carry a vulnerable package. Pass it as --findings instead of --changed. A site that installs from build lists has no easystack, so leave --easystack out: the installed list is the stack.

eb-stack rebuild-set \
  --findings tests/rebuild_set_fixtures/findings.csv \
  --easyconfigs tests/rebuild_set_fixtures/release \
  --installed tests/rebuild_set_fixtures/installed.txt \
  --installed-label x86_64/amd/zen4 \
  --generated-at 2026-10-22T12:00:00Z \
  --out-dir /tmp/findings-out

The command prints:

changed=2 rows=10 must-rebuild=3 review=2 no-rebuild=5 missing=0 easystacks=1 skipped_easyconfigs=0 findings_modules=2 backport=0 fix_routes=3 bump=8/10 in_place=3/10 recommended=0/10 out=/tmp/findings-out

findings.md ranks each module by weighted score per in-place rebuild:

| Rank | Module | Reach | Highest | C | H | M | L | Fixed | Score | In place | Bump | Value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | `zlib/1.3.1-GCCcore-15.2.0` | unclassified | Critical | 1 | 0 | 0 | 1 | 1/2 | 11 | 4 | 8 | 2.75 |
| 2 | `libpng/1.6.50-GCCcore-15.2.0` | unclassified | High | 0 | 1 | 0 | 0 | 1/1 | 5 | 2 | 3 | 2.50 |

A backported zlib patch rebuilds 4 modules; a zlib version bump rebuilds 8. The Reach column is unclassified: the built-in names do not include zlib or libpng, and this command was run without --reachability.

The backport list

backport.md is written next to findings.md. A module is on the list when its reach class is cross-user or network-facing. The built-in names are Jupyter server, JupyterLab, notebook, cURL, urllib3, aiohttp, tornado, cryptography, and git. --reachability is a file of name class lines that replaces one of those names or adds one. local-only and not-reachable are recorded and left off the list. A name in neither place stays unclassified, which is not a judgment about the finding.

A Python interpreter whose fixed_in stays on the same minor is named under Python patch releases. Keeping the module path costs the in-place column. Renaming the easyconfig to that patch version costs the bump column. The note does not by itself put Python on the backport list.

The same file then writes one patch scaffold per chosen advisory. The filename is <Name>-<version>_<ID>.patch. The Python block is the patches assignment and the checksum line to append after the source checksums. A fix commit URL is included when the export names one. A module that --filter-deps drops is listed under OS errata and gets no scaffold. A cURL finding states the --filter-deps=cURL trade-off: the flag changes only new builds, and it moves later cURL fixes to the operating-system errata stream at the cost of the newer protocol features the EasyBuild cURL build carries.

--findings may be Trivy, Grype, or OSV-scanner JSON instead of the CSV. The command detects the shape. A JSON row has no module column, so the installed list supplies it: the package name and version must match Name/version-toolchain. curl matches the module cURL. curl does not match libcurl.

eb-stack rebuild-set \
  --findings findings.csv \
  --reachability reach.txt \
  --easyconfigs tests/rebuild_set_fixtures/release \
  --installed tests/rebuild_set_fixtures/installed.txt \
  --installed-label x86_64/amd/zen4 \
  --generated-at 2026-10-22T12:00:00Z \
  --out-dir /tmp/findings-out

reach.txt for that fixture:

zlib network-facing
libpng local-only

The count line then includes backport=1. zlib is on the list (in place 4, bump 8). libpng is recorded as local-only and is not.

Bump against an in-place patch

The same run writes fix-cost.json, fix-cost.tsv, and fix-cost.md. That table is one row per advisory, not per module. It uses the reach class from backport.md, including --reachability.

A version bump is the reverse-dependency closure, and it breaks reproducibility because the module path changes. An in-place patch keeps the name and version and adds <Name>-<version>_<ID>.patch to patches. It rebuilds the patched module, a bundle that includes the package as an extension or a components entry, and a dependent known to link it statically. A runtime dependency is a shared library and is not rebuilt. A builddependency-only dependent stays out of the in-place count when neither the recipe nor the install says whether the link is static, and the row names it under unknown.

The route is in-place for cross-user and network-facing. It is bump when the package is Python and the fixed release changes the minor or the major version. local-only, not-reachable, and unclassified are defer. A deferred finding rebuilds nothing in the recommended roll-up. The roll-up is the fraction of the installed stack each strategy rebuilds. The count line adds fix_routes=N and those fractions beside backport=N.

Read the three files

out/rebuild-set.md is the table: changed easyconfig, dependent, edge kind, class, and reason, then the counts. A changed filename that is not in the deployed graph is listed and has no row. out/rebuild-set.json is the same document.

out/rebuilds/<YYYYMMDD>-eb-<version>-cve-patches.yml lists class must-rebuild only, with rebuild: true. The date is taken from --generated-at (or from the current date in Coordinated Universal Time (UTC)). One file per EasyBuild version named by the easystack filenames. A second run replaces the rebuilds/*.yml files from the previous run.

--prefix is $EESSI_SOFTWARE_PATH. For each patched module the command reads software/<name>/<version>/lib*/*.a. A patched module with no static archive cannot have been linked statically, so a builddependency-only dependent is no-rebuild and the reason is no static archive installed. Archives that are installed keep the row in review and are named. A missing install directory is a note, and the row stays in review. A prefix with no software directory is an error.

A review dependent is one row. The changed column lists every patched easyconfig that put it there.

--check-static needs --prefix. For each remaining review dependent it reads defined dynamic symbols, the names nm -D --defined-only prints, from the installed Executable and Linkable Format (ELF) files. The patched library’s names come from its shared objects, or from the archive members when the install has no shared object. A hit is must-rebuild. No hit is no-rebuild. An empty export set stays in review, because there was nothing to look for.

The symbol scan can go wrong. It sees dynamic symbols only, so a hidden, local, or inlined static link is a false no-rebuild. A short name shared with another library is a false must-rebuild. Scripts, bytecode, and libraries opened with dlopen are invisible. A static archive shows that a static link was possible, not that it happened.

Why a runtime dependency needs no rebuild, and why a bundle extension does, is covered in what an in-place patch forces a rebuild of.