@@ -117,27 +117,55 @@ if [ "$rc" != 0 ]; then
117117fi
118118echo " absence: no fixup error (exit $rc )"
119119
120- # ── 2. ...and with the host runtime allowed, it must BUILD ─────────────────
121- # The green half. Without it, part 1 could be satisfied by mcpp failing for
122- # some accepted reason on every platform, which is not what "the build is
123- # unaffected" means.
120+ # ── 2. THE CONTROL: describe the same SubOS, change nothing else ───────────
121+ # The green half. Without it, part 1 could be satisfied by mcpp failing for some
122+ # accepted reason on every platform, which is not what "the build is unaffected"
123+ # means. This is also what proves the degradation in part 1 is a degradation and
124+ # not a broken toolchain: same home, same payloads, same project — one JSON
125+ # block is the entire difference.
124126#
125- # ⚠️ THIS IS WHAT WAS BROKEN. In the reported sandbox, `allow_host_libs = true`
126- # did NOT help: the fixup gate fired before the hermeticity policy was ever
127- # consulted, so the one escape hatch mcpp documents for this exact situation
128- # was unreachable. Absence must cost hermeticity and nothing else.
129- cat >> mcpp.toml << 'EOF '
130-
131- [build]
132- allow_host_libs = true
133- EOF
127+ # ⚠️ NOT `allow_host_libs = true`. That was the first version and it FAILED ON
128+ # CI while passing here: falling back to the host needs a host C runtime, and
129+ # the runners have no `crt1.o` / `libm` to fall back TO. The green half must not
130+ # depend on a fact about the machine — binding to the payload glibc does not.
131+ # ⚠️ ASK THE REAL HOME WHICH GLIBC IT USES, do not take the first directory.
132+ # A machine with two glibc payloads installed has one the toolchain was patched
133+ # against and one it was not, and `ls | head -1` picks by alphabetical order —
134+ # which would make this control fail for a reason that has nothing to do with
135+ # what it is controlling for.
136+ GLIBC_DIR=" $MCPP_HOME /registry/data/xpkgs/xim-x-glibc"
137+ GLIBC_VER=" $( python3 - " $REAL_HOME /registry/subos/default/.xlings.json" << 'PY '
138+ import json, sys
139+ try:
140+ rt = json.load(open(sys.argv[1], encoding="utf-8"))["subos_info"]["runtime"]
141+ print(rt.split("@", 1)[1] if "@" in rt else "")
142+ except Exception:
143+ print("")
144+ PY
145+ ) "
146+ [ -n " $GLIBC_VER " ] && [ -d " $GLIBC_DIR /$GLIBC_VER " ] \
147+ || GLIBC_VER=" $( ls " $GLIBC_DIR " 2> /dev/null | head -1) "
148+ [ -n " $GLIBC_VER " ] || { echo " SKIP: no glibc payload to bind to" ; exit 0; }
149+ python3 - " $MCPP_HOME /registry/subos/default/.xlings.json" " $GLIBC_VER " << 'PY '
150+ import json, sys
151+ path, ver = sys.argv[1], sys.argv[2]
152+ json.dump({"workspace": {},
153+ "subos_info": {"schema_version": 1, "runtime": "glibc@" + ver,
154+ "host_glibc": ver, "envs": {}}},
155+ open(path, "w", encoding="utf-8"))
156+ PY
134157rm -rf target
135- " $MCPP " build > allow.log 2>&1 || {
136- echo " FAIL: even with allow_host_libs, an undescribed default SubOS blocks"
137- echo " the build. That is the escape hatch being unreachable."
138- tail -20 allow.log | sed ' s/^/ /'
158+ " $MCPP " build > described.log 2>&1 || {
159+ echo " FAIL: the SAME home builds nothing even once the SubOS describes"
160+ echo " itself (runtime glibc@$GLIBC_VER ), so part 1 above proved"
161+ echo " nothing — this environment cannot build either way."
162+ tail -20 described.log | sed ' s/^/ /'
139163 exit 1; }
140- echo " absence + allow_host_libs: builds"
164+ echo " described (glibc@$GLIBC_VER ): builds"
165+
166+ # ...and restore the absent state for part 3, so the install path is exercised
167+ # against the condition this test is about.
168+ printf ' {"workspace":{}}' > " $MCPP_HOME /registry/subos/default/.xlings.json"
141169
142170# ── 3. `mcpp toolchain install` survives it too ─────────────────────────────
143171# The path the fix could most easily have BROKEN: it carries no RuntimeBinding
0 commit comments