Repository navigation
fix(buildfs): refuse data/ declarations that collide after pointer projection - #2105
Merged
Merged
Conversation
…ojection A blob pointer is staged at its blob's name, so a committed data/<blob> and a data/<blob>.fetch (or two pointers naming one blob) silently overwrote each other and the image depended on walk order. Reject the collision before anything is fetched (#1356).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fbuild buildfsstagesdata/into a filesystem image and resolves fbuild blobpointers (
.fetch, and JSON.lnk) at their projected name —data/video1.rgb.fetchships as
video1.rgb. Nothing checked that projection, so two declarations couldland on the same slot in the image and the last one staged silently won:
data/video1.rgbplusdata/video1.rgb.fetch— the blob replaced thecommitted binary (or not, depending on walk order);
data/video1.rgb.fetchplusdata/video1.rgb.lnk— one pointer overwrote the other.Both build "successfully" and produce an image whose content depends on directory
iteration order. This is the "two declarations naming the same file with conflicting
targets" error case from #1356, and it is silently wrong today.
Fix
ensure_unique_projections(&entries)runs insidestage_dataimmediately after thetree is walked and before anything is fetched, so a colliding tree fails without
touching the network or the disk cache:
FastLED's plain-text runtime
.lnkasset links are not fbuild pointers — they shipas data under their own name — so
track.mp3.lnknext to a committedtrack.mp3keepsworking unchanged (guarded by a test).
Tests
soldr cargo test -p fbuild-cli --bin fbuild buildfs-> 43 passed; 0 failed (4 new):committed_file_and_pointer_with_the_same_projected_name_is_an_errortwo_pointers_projecting_to_the_same_blob_name_is_an_errordistinct_pointers_and_runtime_lnk_links_stage_without_collision(no false positives)stage_data_refuses_a_projection_collision_before_fetching— goes throughstage_data,so deleting the call fails the test (verified: it fails with the call commented out)
Gates:
soldr cargo clippy -p fbuild-cli --all-targets --no-deps -- -D warningsexit 0,cargo fmt --checkclean,ci/enforce_platform_boundary.py --print-totals-> 44/43,buildfs.rs974 LOC (< 1000 gate).#1356 stays open: the destination vocabulary (
deston.fetch), the end-of-build"fetched but unconsumed" warning, and the platform capability matrix still need their
own rulings.