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

Misleading message when using invalid (?) include field #6830

Closed
Thomasdezeeuw opened this issue Apr 8, 2019 · 2 comments · Fixed by #6925
Closed

Misleading message when using invalid (?) include field #6830

Thomasdezeeuw opened this issue Apr 8, 2019 · 2 comments · Fixed by #6925
Labels
C-bug Category: bug

Comments

@Thomasdezeeuw
Copy link

Problem

When using an invalid (?) include field in Cargo.toml cargo package will fail with "failed to verify package tarball".

Steps

  1. Create a new repo, cargo init tmp && cd tmp
  2. Add include = [ "./src/main.rs" ] to Cargo.toml.
  3. Add and commit everything: git add . && git commit -m "init".
  4. Package (or publish) the create: cargo package
   Packaging tmp v0.1.0 (/private/var/folders/lq/rzq0zxld0bb5mcy4jl1txrf00000gn/T/tmp.1svg10Al/tmp)
   Verifying tmp v0.1.0 (/private/var/folders/lq/rzq0zxld0bb5mcy4jl1txrf00000gn/T/tmp.1svg10Al/tmp)
error: failed to verify package tarball

Caused by:
  failed to read `/private/var/folders/lq/rzq0zxld0bb5mcy4jl1txrf00000gn/T/tmp.1svg10Al/tmp/target/package/tmp-0.1.0/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

Possible Solution(s)

In the actual code I dropped ./ from the include field and it worked, it doesn't seem to be the case with a new crate.

Notes

Output of cargo version: cargo 1.35.0-nightly (0e35bd8 2019-03-13) (currently can't get a newer version due to clippy being broken on nightly).

@Thomasdezeeuw Thomasdezeeuw added the C-bug Category: bug label Apr 8, 2019
@ehuss
Copy link
Contributor

ehuss commented Apr 12, 2019

I think this is the same as #4660.

@alexcrichton Do you know if there's a reason why include does not automatically add Cargo.toml? I can sympathize with implicit magic making it hard to understand how something works, but in this case making everyone add it seems a little unnecessary.

@alexcrichton
Copy link
Member

@ehuss seems like a reasonable bug in Cargo, agreed we should just include it by default

bors added a commit that referenced this issue May 10, 2019
Always include `Cargo.toml` when packaging.

Since `Cargo.toml` is required, might as well include it automatically rather than force everyone to include it explicitly. If it is not listed in `include`, there was a somewhat confusing error message when packaging.

Closes #6830
Closes #4660
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

Successfully merging a pull request may close this issue.

3 participants