Skip to content

cargo package --no-verify fails if a package's version req is too high for the registry (but works locally) #15059

@weihanglo

Description

@weihanglo

Problem

#13447 dd698ff has some unintentional consequences:

cargo package after that generates a lockfile also when packaging libraries.
However, if the crate being packaged depends on some unpublished dependencies. When generating the lockfile Cargo then can't find unpublished deps on registry index, so it bailed out.

Steps

This could be simplly reproduced in rust-lang/cargo as of today (2025-01-13)

  1. Checkout to 54df3c7
  2. Bump cargo-test-support to an unpublished version such as 99.99.99
  3. cargo +1.83.0 package -p cargo-test-support --no-verify — succeeded
  4. cargo +1.84.0 package -p cargo-test-support --no-verify — failed

Possible Solution(s)

Assume if we have passed the local registry unconditionally, we shouldn't have the issue today.

let mut local_reg = if ws.gctx().cli_unstable().package_workspace {
let reg_dir = ws.target_dir().join("package").join("tmp-registry");
sid.map(|sid| TmpRegistry::new(ws.gctx(), reg_dir, sid))
.transpose()?
} else {
None
};

Version

  • cargo 1.84.0 (66221abde 2024-11-19)
  • cargo 1.86.0-nightly (088d49608 2025-01-10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-packageS-triageStatus: This issue is waiting on initial triage.regression-from-stable-to-stableRegression in stable that worked in a previous stable release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions