Skip to content

Cargo should warn if package.include doesn't contain a Cargo.toml #4660

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
torkleyy opened this issue Oct 25, 2017 · 5 comments · Fixed by #6925
Closed

Cargo should warn if package.include doesn't contain a Cargo.toml #4660

torkleyy opened this issue Oct 25, 2017 · 5 comments · Fixed by #6925
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself.

Comments

@torkleyy
Copy link
Contributor

torkleyy commented Oct 25, 2017

How to reproduce:

cargo new hello
cd hello
vi Cargo.toml

Add the following line to the package table:

include = ["hello.txt"]

And then create that file:

touch hello.txt

Finally, try to execute

cargo package

This fails for me with the following error message:

   Packaging hello v0.1.0 (file:///home/thomas/Workspace/hello)
   Verifying hello v0.1.0 (file:///home/thomas/Workspace/hello)
error: failed to verify package tarball

Caused by:
  failed to read `/home/thomas/Workspace/hello/target/package/hello-0.1.0/Cargo.toml`

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

Executing ls target/package/hello-0.1.0/ gives me hello.txt, so it does get included.


Tested versions (same result):

  • cargo 0.23.0-nightly (e447ac7 2017-09-27)
  • cargo 0.22.0 (3423351 2017-10-06)
@torkleyy
Copy link
Contributor Author

As it turns out, I'm stupid and should have added Cargo.toml and src/** to the list, too.

@torkleyy
Copy link
Contributor Author

I'll leave this issue open as a suggestion to warn if there's no Cargo.toml included.

@torkleyy torkleyy changed the title Cargo package does not work together with package.include Cargo should warn if package.include doesn't contain a Cargo.toml Oct 25, 2017
@torkleyy
Copy link
Contributor Author

Now I got the next problem, I can't include a subdirectory containing a Cargo.toml :(

@alexcrichton alexcrichton added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Oct 27, 2017
@stale
Copy link

stale bot commented Sep 19, 2018

As there hasn't been any activity here in over 6 months I've marked this as stale and if no further activity happens for 7 days I will close it.

I'm a bot so this may be in error! If this issue should remain open, could someone (the author, a team member, or any interested party) please comment to that effect?

The team would be especially grateful if such a comment included details such as:

  • Is this still relevant?
  • If so, what is blocking it?
  • Is it known what could be done to help move this forward?

Thank you for contributing!

(The cargo team is currently evaluating the use of Stale bot, and using #6035 as the tracking issue to gather feedback.)

If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable!

@stale stale bot added the stale label Sep 19, 2018
@torkleyy
Copy link
Contributor Author

This is still an issue.

@stale stale bot removed the stale label Sep 19, 2018
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
A-diagnostics Area: Error and warning messages generated by Cargo itself.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants