What does "package foo in Cargo.lock is yanked in registry" mean?

Viewed 717

I was trying to install ripgrep_all using cargo install ripgrep_all. It gave the following error:

% cargo install ripgrep_all
    Updating crates.io index
  Installing ripgrep_all v0.9.6
error: failed to compile `ripgrep_all v0.9.6`, intermediate artifacts can be found at `/tmp/cargo-install5HlOMt`

Caused by:
  failed to select a version for the requirement `cachedir = "^0.1.1"`
  candidate versions found which didn't match: 0.3.0, 0.2.0
  location searched: crates.io index
  required by package `ripgrep_all v0.9.6`

Then I searched a bit and found:

It looks like cachedir yanked version 0.1.1.

And the solution was to:

cargo install --locked ripgrep_all 

I was able to install it successfully. However, During the installation it said:

% cargo install --force --locked ripgrep_all
    Updating crates.io index
  Installing ripgrep_all v0.9.6
warning: package `cachedir v0.1.1` in Cargo.lock is yanked in registry `crates.io`, consider running without --locked
warning: package `smallvec v1.4.0` in Cargo.lock is yanked in registry `crates.io`, consider running without --locked

It made me curious. What does Yank mean in rust world?

1 Answers

It means that the package has been marked as "yanked". This is usually done when the authors of have package have a very compelling reason that a certain version of a package should not be used at all, and to very strongly suggest that the package should not be used. You can ignore yanks with --force to force yanked packages to be used, but that is usually a bad idea: packages were usually yanked for a good reason.

In your case: The yanked cachedir 0.1.X version is a completely different package with a different author than the newer versions. The older versions are unmaintained and cannot be updated (since cachedir now has a different owner who publishes a different package), so the new owner of cachedir yanked the older versions. smallvec 1.4.0 has a bug where it causes Undefined Behaviour when used with zero-sized types, and that UB is bad enough that it is exceedingly unlikely that you actually want to use that version. The fix to this is to update to a later version of smallvec that doesn't have that bug.

Related