Tests are relinked but not recompiled when a dependency's module interface changes, producing ABI-mismatch crashes #26
Labels
No labels
bug
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Build#26
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
When a module interface (
.cppm) in a library configuration changes in a way that alters a type's layout,crafter-build testrebuilds the library and relinks the test executable, but does not recompile the test'smain.cpp. The test's object file still encodes the old layout, so the resulting binary has an ABI mismatch with the library it links against and crashes at runtime — SIGSEGV or SIGABRT — with no build error and nothing in the output to suggest anything is wrong.Reproduction
In
Catcrafts/Crafter.Networkata79ab6a, add a member to an exported class that a test constructs on the stack:tests/ShouldSendRecieveHTTP1/main.cpphasClientHTTP1 client("localhost", 8090);— a stack object whose size just changed. Then:Note there is no
Compiling main.cppstep: the library was rebuilt, the test was relinked, and the stalemain.owas reused. The library's constructor writes 4 KiB past what the caller reserved, so the test's stack is corrupted.rm -rf build bin && crafter-build testpasses cleanly, which confirms the sources are fine and only the incremental path is affected.Why it is worth fixing
The failure mode is unkind: the crash happens far from the cause, it looks like a bug in the code under test, and it stays reproducible until someone thinks to wipe the build directory. On Crafter.Network the first symptom was three unrelated-looking tests failing at once — including a byte-comparison failure in a large-body transfer — immediately after a one-line change that could not have caused any of them.
It also means
crafter-build testcannot be trusted right after an interface edit, which is exactly when a test result matters most.Expected
A test's translation units should be recompiled when any module interface they transitively import changes — the same dependency edge that already correctly triggers the relink, and that already correctly recompiles the library's own implementation files.