Skip to content

Cargo updates registry index on every command with bad permissions #13712

Closed
@Mark-Simulacrum

Description

For a while now I've seen "Updating crates.io index" before every build in the rust-lang/rust repository on one of my computers. I got a chance to investigate today and it looks like that's because of this error:

$ CARGO_LOG=info ./x.py build --stage 0 library/std
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.03s
Building stage0 library artifacts {std} (x86_64-unknown-linux-gnu)
    Updating crates.io index
   0.424170519s  INFO main:exec:compile_ws:create_bcx:resolve_with_registry:resolve_with_previous:resolve: cargo::sources::registry::index::cache: failed to write cache: Permission denied (os error 13) cache_path="/home/mark/.cargo/registry/index/index.crates.io-6f17d22bba15001f/.cache/r-/ef/r-efi"
    Finished `release` profile [optimized + debuginfo] target(s) in 0.67s

That error is because a bunch of the files in the cache directory ended up owned by root rather than my user, probably as a result of a docker build of test-various (see lockfile which contains this crate).

I'm filing this because it seems like we ought to:

  • Not silently ignore this error if it's going to cause us to "Updating..." every build
  • Potentially delete/prune the cache (not sure if possible) rather than failing in this way

In my case r-/ef/r-efi where all owned by root.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-cachingArea: caching of dependencies, repositories, and build artifactsC-bugCategory: bugS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions