rust-lang / rust-lang/cargo

Change `cargo install` error on corrupt metadata to warning

Open
#12,232 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug Command-uninstall S-needs-info
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem

This transcript emphasizes the problem:

$ cargo uninstall zellij
error: corrupt metadata, `/home/jarkko/.cargo/bin/zellij` does not exist when it should

$ touch .cargo/bin/zellij

$ cargo uninstall zellij
    Removing /home/jarkko/.cargo/bin/zellij

$ cargo uninstall zellij
error: package ID specification `zellij` did not match any packages

Why is exiting empty file better than non-existing file? Since cargo does not care of the contents, why is it logical to fail ENOENT case?

Steps

No response

Possible Solution(s)

Change error to warning and proceed on removing the meta-data.

Notes

No response

Version

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the cargo uninstall zellij transcript and trace the cargo uninstall handling for corrupt metadata, especially the missing executable case. Done means the missing-file condition produces a warning, metadata removal continues, and the behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.