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 package is not working #797

Closed
EduardoBautista opened this issue Nov 5, 2014 · 15 comments · Fixed by #1584
Closed

cargo package is not working #797

EduardoBautista opened this issue Nov 5, 2014 · 15 comments · Fixed by #1584
Labels
E-easy Experience: Easy

Comments

@EduardoBautista
Copy link
Contributor

The cargo package command results in:

   Packaging hello_world v0.0.1 (file:///Users/eduardobautista/Projects/hello_world)
   Verifying hello_world v0.0.1 (file:///Users/eduardobautista/Projects/hello_world)
failed to verify package tarball

This is on a newly generated cargo project using the October 31st build 492bc86 on OS X.

@EduardoBautista
Copy link
Contributor Author

Also, even if I pass --no-verify the tarball will be empty.

@alexcrichton
Copy link
Member

Can you paste the full error with cargo package -v

@EduardoBautista
Copy link
Contributor Author

   Packaging hello_world v0.0.1 (file:///Users/eduardobautista/Projects/hello_world)
   Verifying hello_world v0.0.1 (file:///Users/eduardobautista/Projects/hello_world)
failed to verify package tarball

Caused by:
  couldn't create file (no such file or directory (No such file or directory); path=/Users/eduardobautista/Projects/hello_world/target/package/hello_world-0.0.1/Cargo.lock; mode=truncate; access=write)

@EduardoBautista
Copy link
Contributor Author

Updated rust and cargo before running cargo package -v

@alexcrichton
Copy link
Member

I still can't seem to reproduce this, does it still reproduce for you on a recent cargo?

@EduardoBautista
Copy link
Contributor Author

@alexcrichton Yes, just tested on the latest nightly. Maybe it is something about my computer.

@alexcrichton
Copy link
Member

Can you provide the exact set of commands to reproduce this?

@EduardoBautista
Copy link
Contributor Author

@alexcrichton Sorry for the late response! Here are the steps:

cargo new hello_world --bin
cd hello_world
cargo package --verbose

The cargo package command resulted in this:

   Packaging hello_world v0.0.1 (file:///Users/eduardobautista/Projects/hello_world)
   Verifying hello_world v0.0.1 (file:///Users/eduardobautista/Projects/hello_world)
failed to verify package tarball

Caused by:
  couldn't create file (no such file or directory (No such file or directory); path=/Users/eduardobautista/Projects/hello_world/target/package/hello_world-0.0.1/Cargo.lock; mode=truncate; access=write)

@alexcrichton
Copy link
Member

It looks like this is happening because the newly created folder is a new git repository and doesn't have any files in its index. This means that no files are copied into the folder (because cargo thinks the project has no files). We should probably run git add . essentially whenever we create a new git repository.

@alexcrichton alexcrichton added the E-easy Experience: Easy label Nov 18, 2014
@steveklabnik
Copy link
Member

git add . is probably a bad idea. If you check out my suggestions for what cargo package should do over in #841 , it would prevent this from happening in a way that doesn't automatically add possibly private files to repos :)

@steveklabnik
Copy link
Member

(and it would be git add -A iirc)

@alexcrichton
Copy link
Member

Oh I'm not saying that we should run git add on cargo package, only on cargo new where the only files in the directory are those that we just generated.

@steveklabnik
Copy link
Member

Ah!

@nagisa
Copy link
Member

nagisa commented Feb 21, 2015

Hit this today as well.

@ghost
Copy link

ghost commented Feb 21, 2015

Bump.
Mac OSX 10.10.2
rustc 1.0.0-nightly (6c065fc8c 2015-02-17) (built 2015-02-18)
Trace

$ cargo package --verbose
   Packaging token v1.0.0-rc1 (file:///Users/<user>/Code/rust/<folder>)
   Verifying token v1.0.0-rc1 (file:///Users/<user>/Code/rust/<folder>)
failed to verify package tarball

Caused by:
  couldn't create file (no such file or directory (No such file or directory); path=/Users/<user>/Code/rust/<folder>/target/package/<package-version>/Cargo.lock; mode=truncate; access=write)

EDIT
I found the solution.

Cargo is apparently not using case-insensitive paths on OSX systems (though it probably should).

I'm not sure how it happened, but the folder "Code" has technically been renamed to "code", perhaps from the terminal... apparently this hadn't been set in some part of the metadata, so renaming the folder in Finder did the trick.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue May 5, 2015
bors added a commit that referenced this issue May 5, 2015
Closes #797
Closes #1575 

This is a reopening of #1170 but I see the two closed issues as important enough that this needs to land in some form or another, and I'm more comfortable with always taking into account untracked files than only if there isn't a commit yet.
@bors bors closed this as completed in #1584 May 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Experience: Easy
Projects
None yet
4 participants