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 new" executed in a drive root hangs #4091

Closed
arkanes opened this issue May 24, 2017 · 5 comments · Fixed by rust-lang/rust#42246
Closed

"cargo new" executed in a drive root hangs #4091

arkanes opened this issue May 24, 2017 · 5 comments · Fixed by rust-lang/rust#42246

Comments

@arkanes
Copy link

arkanes commented May 24, 2017

Executing cargo new directly in a drive root on Windows (eg, C:\ or D:) causes cargo to hang indefinitely at 100% CPU usage. Watching file access using ProcMon shows it attempting to open .git and objects directories, making me think that it's trying to scan upwards for a parent git repo.

Possibly related to #3783?

λ  cargo --version
cargo 0.18.0 (fe7b0cdcf 2017-04-24)
@alexcrichton
Copy link
Member

Thanks for the report! This is likely coming from libgit2 and is probably a bug in libgit2, but it'd be great if we could work around it. If you've got a reliable reproduction of this it'd be great if you could help out debugging! If we could get a backtrace that'd be invaluable for figuring out what's going wrong here.

@arkanes
Copy link
Author

arkanes commented May 26, 2017

I've traced this back and confirmed that it is a bug in libgit2. It's a loop in git_discover_repository caused by bugs in libgit2s path implementation. It's known and fixed in the latest versions of libgit2:

libgit2/libgit2#4106

I'm not sure if there's any reasonable workaround beyond updating to the latest version of libgit2, short of implementing a manual version of repo scanning.

@arkanes
Copy link
Author

arkanes commented May 26, 2017

Oh, it's worth noting that I'm pretty sure the title of the issue, which says this only happens on directories other than C;\ is just wrong - reviewing the fixes, there's no reason I can see why c:\ is special and bugs reported against other libgit2 language bindings correctly identify it happening in any drive root. Further, the fix itself uses C:\ as its test case.

@alexcrichton
Copy link
Member

Oh excellent! I'll go update libgit2 so we can get that bugfix. Thanks so much for investigating!

alexcrichton added a commit to rust-lang/git2-rs that referenced this issue May 26, 2017
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 26, 2017
This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
@alexcrichton
Copy link
Member

Ok I've published libgit2-sys 0.6.11 which should have this fix, I've sent a PR to rust-lang/rust to update the lockfile as well.

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 26, 2017
…tsakis

Updated locked version of libgit2

This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 27, 2017
…tsakis

Updated locked version of libgit2

This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 27, 2017
…tsakis

Updated locked version of libgit2

This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 28, 2017
…tsakis

Updated locked version of libgit2

This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
alexcrichton added a commit to alexcrichton/rust that referenced this issue May 28, 2017
This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
bors added a commit to rust-lang/rust that referenced this issue May 29, 2017
Updated locked version of libgit2

This should include a fix for rust-lang/cargo#4091 with an updated version of
libgit2.

Closes rust-lang/cargo#4091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants