Repository navigation
Description
full / macos / Check and full / macos / Test fail on every PR branch that has
merged current main, because a macOS-only case-folding bug in the merged
compile-database code emits a source spelling that is not the one on disk.
Evidence
Job full / macos / Test (macos-15) on run 44048154994 (branch
feat/ape-host-tools, head aa4f35fc, i.e. main 9b0892fd merged in — the
branch does not touch fbuild-build-engine):
compile_database::merge::merge_tests::reroot_spells_sources_relative_to_the_project
assertion `left == right` failed
left: [..., "../opt/idf/components/freertos/freertos-kernel/tasks.c", ...]
right: [..., "../opt/idf/components/freertos/FreeRTOS-Kernel/tasks.c", ...]
compile_database::merge::merge_tests::merge_adds_framework_entries_only_idf_compiled
missing delegated entry ../opt/idf/components/freertos/FreeRTOS-Kernel/tasks.c
test result: FAILED. 572 passed; 2 failed
Linux is green at the same commit, so the test only diverges where the
filesystem is case-insensitive.
Root cause
crates/fbuild-build-engine/src/compile_database/merge.rs, relative_spelling:
let path_key = normalize_for_key(path); // = platform::fs::comparison_key(normalize(path))
let base_key = normalize_for_key(base);
...
parts.extend(path[common..].iter().map(|c| c.as_os_str().to_string_lossy().into_owned()));The relative path is built out of the case-folded comparison keys, so the
emitted file/output spelling inherits the folded case. On macOS/Windows
comparison_key lowercases, so FreeRTOS-Kernel/tasks.c is written out as
freertos-kernel/tasks.c. The key is right; the spelling is wrong, and a
compile database is read by tooling (IDE indexers, replay) that opens those
paths — on a case-sensitive APFS volume it would not resolve at all.
Fix sketch
Keep two parallel component vectors — the key components for prefix matching
and the original components for emission — and join the original spelling of
path[common..]. Same for base.len() - common (only the .. count is used,
so that half is already spelling-independent). Add a unit test that pins the
spelling: assert reroot never changes the case of a component it did not
resolve.
Filed from the steward tick that resolved PR #1633's merge conflict; this is
the only thing keeping that branch's macOS cells red.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity