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

cargo publish --dry-run should report unsupported category slugs #14184

Closed
gendx opened this issue Jul 3, 2024 · 1 comment
Closed

cargo publish --dry-run should report unsupported category slugs #14184

gendx opened this issue Jul 3, 2024 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@gendx
Copy link

gendx commented Jul 3, 2024

Problem

When running cargo publish --dry-run on a crate with a category unsupported on crates.io, the dry run succeeds, but when running the real cargo publish, this now triggers a hard error (since rust-lang/crates.io#8930):

error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error (status 400 Bad Request): The following category slugs are not currently supported on crates.io: voting

  See https://crates.io/category_slugs for a list of supported slugs.

It would be good if the dry run could detect that.

Proposed Solution

Cargo could contact an endpoint on the registry (be it crates.io or wherever the package is being published) to fetch the list of existing categories, and match that locally against the categories defined in the Cargo.toml.

Apart from the rare TOCTOU when the list of categories changes (does it ever change?), this should be sufficient to make the dry run more representative of the real run.

Notes

No response

@gendx gendx added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Jul 3, 2024
@ehuss
Copy link
Contributor

ehuss commented Jul 3, 2024

Thanks for the report! The issue looks like a duplicate of #4377, so closing in favor of that.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants