Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remap crates fetched via sparse registry as well #1888

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

iximeow
Copy link
Member

@iximeow iximeow commented Oct 1, 2024

on Rust nightlies since about 2023-03-09 it seems the default (-on-nightly?) Cargo protocol switched to "sparse". this has a side effect of caching fetched crates at a different path, so the github.com path remapping is no longer sufficient to normalize all crate paths.

we then picked that change up back at v1.0.14, bumping nightly forward a year and change, so local builds of hubris between then and v1.0.26 have source paths that are not actually remapped :(

thankfully, to make it sufficient we only have to handle the new index.crates.io-6f17d22bba15001f path as well. this in fact is where all cargo-fetched crates.io dependencies end up now.

technically we could forget about github.com-1ecc6299db9ec823 at this point, but by keeping it we'll still be correct in the unlikely event someone were to flip away from sparse to git for the Cargo protocol.

when i built gimlet-v1.0.26 with this patch the resulting images no longer have my home directory in them.

... i am deeply perplexed that with this change the resulting gimlet-b image is 0x2200 bytes larger though???

a funny consequence of this is that to reproduce the hubris releases from 1.0.14 to ... now ... you actually have to remap the index.crates.io directory to /home/runner/.cargo/registry/src/index.crates.io-6f16d22bba15001f. by doing this i just built a gimlet-b that matches the one here.

on Rust nightlies since about 2023-03-09
(https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-168-2023-03-09)
it seems the default protocol switched to "sparse". this has a side
effect of caching fetched crates at a different path, so the
`github.com` path remapping is no longer sufficient to normalize all
crate paths.

thankfully, to make it sufficient we only have to handle the new
`index.crates.io-6f17d22bba15001f` path as well. this in fact is where
*all* cargo-fetched crates.io dependencies end up now.

technically we could forget about `github.com-1ecc6299db9ec823` at this
point, but by keeping it we'll still be correct in the unlikely event
someone were to flip away from `sparse` to `git` for the Cargo protocol.
@iximeow iximeow merged commit a677a8d into master Oct 2, 2024
106 checks passed
@iximeow iximeow deleted the remap-cratesio-paths branch October 2, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants