Skip to content

fix(pace-cc): leave the machine's /usr/include out of a GNU toolchain's fingerprint - #1784

Merged
christianparpart merged 1 commit into
masterfrom
fix/fingerprint-system-includes
Nov 16, 2026
Merged

christianparpart merged 1 commit into
masterfrom
fix/fingerprint-system-includes

Conversation

@christianparpart

Copy link
Copy Markdown
Member

Two Fedora 44 machines with identical compiler packages computed a different toolchain fingerprint for every compiler (g++/gcc 16.2.1, clang 22.1.8, clang 20.1.8). As a result the fleet never dispatched a compile between them. The fingerprint folded every root of the driver's -v search list, including the machine's /usr/include and /usr/local/include. Those differed: 137 vs 109 -devel packages, plus hand-installed headers.

A worker compiles preprocessed text, so those trees cannot change a dispatched object. An strace of preprocessed compiles under gcc and clang opens nothing beneath them, apart from the source excerpt a diagnostic note prints to stderr. No cache key folds the fingerprint.

Change

  • The GNU fingerprint rows drop the roots in a new SystemIncludeDirectories table: /usr/local/include and /usr/include.
  • A root is matched by equality of what it resolves to, through a new IToolchainHost::ResolveDirectory. Spelling and containment are never used.
  • These stay folded: libstdc++ (/usr/include/c++/<v>, nested under a dropped root), the resource directory, sysroots, unresolvable roots, drive-relative hosts, and Debian/Ubuntu multiarch (Fingerprint: /usr/include/<multiarch> still splits Debian/Ubuntu machines #1783).
  • FingerprintSchema is now toolchain-v4. v3 and v4 nodes match nothing until both are upgraded. A pinned --toolchain=<fingerprint>=<compiler> must be re-derived.
  • Docs, rules and an AGENT.md tripwire are updated.

Tests

  • Identical compilers with different system include trees give the same fingerprint.
  • A change under libstdc++ or the resource directory still gives a different one.
  • A sysroot root stays folded.
  • Neutering check: switching the classifier to a prefix match turns exactly the libstdc++ checks red.

Measured: this build's pace-cc --print-toolchain-fingerprint gives identical fingerprints on both machines for every compiler. The local gate passed: clang-debug 7921/7921, gcc-release 7920/7920.

Refs #1783

…'s fingerprint

Two Fedora 44 machines with identical compiler rpms (`rpm -V` clean) computed a
different fingerprint for every toolchain -- g++ and gcc 16.2.1, clang 22.1.8,
clang 20.1.8 -- so the fleet never dispatched between them. Banners, include-root
lists and every compiler-owned tree were byte-identical; what differed was
/usr/local/include (136 vs 8 files of hand installs) and /usr/include (12853 vs
13032 files, 137 vs 109 -devel packages). The fingerprint folded every root of the
driver's `-v` search list, so it identified which LIBRARIES were installed beside
the compiler rather than the compiler.

Those trees cannot change a dispatched compile's object: the worker compiles text
the client already preprocessed, as `-x c++-cpp-output` / `-x cpp-output`, and
strace of a clean such compile under gcc 16.2, clang 22.1 and clang 20.1, C and
C++, opens nothing beneath either directory (no stdc-predef.h pre-include on
preprocessed input). gcc does open a header beneath them when a diagnostic note
points into it, only to print the source excerpt; that reaches stderr, never the
object. The cache key hashes the preprocessed text and does not fold the
fingerprint at all, so no key relied on these trees.

The GNU rows (`FingerprintTree::OwnTreeWhenTargetingMsvc`, renamed `OwnTrees`) now
drop the roots in `SystemIncludeDirectories` -- /usr/local/include and
/usr/include -- recognised by EQUALITY of what they RESOLVE to through a new
`IToolchainHost::ResolveDirectory`, never by spelling and never by containment:
libstdc++ resolves to /usr/include/c++/16, nested under a dropped root, and stays
folded with the compiler's resource directory. Erring narrow: an unresolvable
root, any root on a drive-relative host, a sysroot's usr/include, and Debian and
Ubuntu's /usr/include/<multiarch> stay folded -- so on Debian/Ubuntu two machines
still need matching -dev sets (#1783). Discovery, the stamp and the node's
evidence are unchanged.

FingerprintSchema moves to toolchain-v4. A v3 node and a v4 node match nothing
until both are upgraded. An operator's pinned `--toolchain=<fingerprint>=<compiler>`
is never re-derived, so a pin written under v3 silently matches nothing after the
upgrade: re-derive it (`pace-cc --print-toolchain-fingerprint <compiler>`) or remove
it. No objkey-v*/manifest-v* bump, since no key folds the fingerprint.

Measured with this build's `pace-cc --print-toolchain-fingerprint` on both
machines: /usr/bin/{g++,gcc,clang,clang++,clang-20} fingerprint identically.

Refs #1783

Signed-off-by: Christian Parpart <christian@parpart.family>
@christianparpart christianparpart added the type/bug Behaves incorrectly against its stated contract label Nov 16, 2026
@github-actions github-actions Bot added area/launcher apps/fastcache-cc/ - the compiler launcher and its cache key area/compile-cache CompileCache/, the 0xFC wire, the executor, PathCanon area/distributed Distributed/, apps/fastcache-compile-node/ - dispatch, workers, scheduler labels Nov 16, 2026
@christianparpart
christianparpart merged commit 8fee5f9 into master Nov 16, 2026
35 checks passed
@christianparpart
christianparpart deleted the fix/fingerprint-system-includes branch November 16, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compile-cache CompileCache/, the 0xFC wire, the executor, PathCanon area/distributed Distributed/, apps/fastcache-compile-node/ - dispatch, workers, scheduler area/launcher apps/fastcache-cc/ - the compiler launcher and its cache key type/bug Behaves incorrectly against its stated contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant