Skip to content

Crate with a keyword containing space fails during publish, but not during dry run. #8482

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

Closed
patriksvensson opened this issue Jul 13, 2020 · 1 comment
Labels
C-bug Category: bug

Comments

@patriksvensson
Copy link
Contributor

Problem
I tried to specify a keyword within Cargo.toml that contained a space. Running cargo publish --dry-run showed that the package was valid, but submitting it to crates.io failed with an API error.

keywords = ["foo", "foo bar"]

I appreciate that you might not want to tie implementation details in crates.io to cargo publish in case this theoretically could be supported in other package repository implementations, but I thought I would report this anyway. If you decide that this is a bug, I'm more than happy to submit a pull request for it.

Steps

  1. Create a new crate
  2. Add a keyword with a space in it, such as keywords = ["foo", "foo bar"]
  3. Run cargo publish --dry-run: Does not display any errors.
  4. Publish crate using cargo publish: Returns an API error.

Possible Solution(s)
Display an error after a dry run if there is a space in a keyword.

Notes

The output from cargo publish:

> cargo publish
   Updating crates.io index
   Packaging foo v0.1.0 (D:\Source\github\patriksvensson\foo)
   Verifying foo v0.1.0 (D:\Source\github\patriksvensson\foo)
   Finished dev [unoptimized + debuginfo] target(s) in 1.06s
   Uploading foo v0.1.0 (D:\Source\github\patriksvensson\foo)
error: api errors (status 200 OK): invalid upload request: invalid value: string "foo bar", expected a valid keyword specifier at line 1 column 555
@patriksvensson patriksvensson added the C-bug Category: bug label Jul 13, 2020
@ehuss
Copy link
Contributor

ehuss commented Jul 13, 2020

Thanks for the report. This appears to be a duplicate of #4300, so closing in favor of that.

@ehuss ehuss closed this as completed Jul 13, 2020
alistair23 added a commit to alistair23/tock that referenced this issue May 22, 2022
According to rust-lang/cargo#8482 we can't
have spaces or slashes in the keywords.

Signed-off-by: Alistair Francis <[email protected]>
bors bot added a commit to tock/tock that referenced this issue May 25, 2022
3044: libraries/tickv: Remove space from keyword r=hudson-ayers a=alistair23

### Pull Request Overview

According to rust-lang/cargo#8482 we can't
have spaces or slashes in the keywords.

Signed-off-by: Alistair Francis <[email protected]>

### Testing Strategy

`cargo publish`

### TODO or Help Wanted

### Documentation Updated

- [X] Updated the relevant files in `/docs`, or no updates are required.

### Formatting

- [X] Ran `make prepush`.


Co-authored-by: Alistair Francis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants