From fb3c72aa2874298a1398275db494c0635f30bc65 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 27 Aug 2026 14:50:53 -0500 Subject: [PATCH] docs(hardlink): withdraw the nlink claim, which asserted more than was measured MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comments said hardlink count at link time was ruled out as the discriminator between a rewritten executable and an intact one, citing a lib+bin crate whose two test binaries were both `nlink == 1` and appeared to behave differently. Re-checked on review: the intact one had not been rebuilt at all — same content, same inode — so it demonstrated nothing, and forcing both to rebuild rewrote both. What was actually observed is narrower and now says so: every executable measured intact had an uplift hardlink twin Cargo must re-create anyway, every one measured rewritten had none, and whether the twin is the mechanism or a correlate was not determined. The rule does not rest on the answer — exempting twinned executables would recover none of the bytes this change newly copies. This PR exists because a claim outlived its evidence; it should not ship one. --- scripts/cache-lib.sh | 13 +++++++++---- scripts/hardlink-clone-selftest.sh | 7 ++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/cache-lib.sh b/scripts/cache-lib.sh index d898e0b..d24ac4c 100755 --- a/scripts/cache-lib.sh +++ b/scripts/cache-lib.sh @@ -523,10 +523,15 @@ unshare_mutable_paths() { # Measured 2026-08-27 on cargo 1.93.1 stable, 1.96.0-nightly, 1.98.0-nightly # (layout v1) and 1.100.0-nightly (e8cb624d5, layout v2), mold and the # default linker alike: a `cargo test --no-run` binary in a `cp -al` clone - # rewrote the SOURCE's copy of itself in place, under both layouts. Hardlink - # count at link time is NOT what decides it — measured 2 in both a rewritten - # and an intact case, and two test binaries of one crate at `nlink == 1` - # behaved differently from each other. See gitdan-actions#17. + # rewrote the SOURCE's copy of itself in place, under both layouts. + # + # What separates that from the executables measured INTACT is not + # established. Every intact case observed was one Cargo has to re-create + # anyway to maintain an uplift hardlink — a bin target's + # `deps/-`, twinned at `/`. Whether the twin is the + # mechanism or a correlate of it was not determined, and the rule below does + # not depend on the answer: exempting twinned executables would recover no + # bytes this function newly copies. See gitdan-actions#17. # # The executable bit is the discriminator because it is the linker's own # output that is at risk, not the directory it happens to land in — `.rlib`, diff --git a/scripts/hardlink-clone-selftest.sh b/scripts/hardlink-clone-selftest.sh index 57fb578..9d76b77 100755 --- a/scripts/hardlink-clone-selftest.sh +++ b/scripts/hardlink-clone-selftest.sh @@ -587,9 +587,10 @@ echo "=== a linked TEST binary, which nothing uplifts and nothing replaces ===" # dep-info mutations the previous scenario already covers, and the scenario # pinned nothing. A bin-only crate with a unit test does exhibit the rewrite, # on cargo 1.93.1 stable and on 1.98.0-nightly and 1.100.0-nightly, so that is -# what this builds. `nlink` does not predict which is which — two test binaries -# of one crate, both at 1, behaved differently — so the shape is chosen by -# measurement rather than derived. +# what this builds. The shape is chosen by measurement rather than derived: +# what separates a rewritten executable from an intact one is not established, +# so the only crate shape this scenario may rest on is one observed to exhibit +# the rewrite. mkbincrate() { local dir="$1" marker="$2" mkdir -p "$dir/src"