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 creates a weird _git2 symlink #7173

Closed
akatechis opened this issue Jul 24, 2019 · 4 comments · Fixed by #7176
Closed

cargo new creates a weird _git2 symlink #7173

akatechis opened this issue Jul 24, 2019 · 4 comments · Fixed by #7176
Labels
C-bug Category: bug

Comments

@akatechis
Copy link

Problem
I'm not sure if it's even a bug, but I am running on Windows 10 Pro. I use Git Bash, as my "terminal", and when I create a new rust binary project, along with all the expected files/directories, I get what looks like a weird link file to some sort of testing file/dir.

If I try to open that link as a directory, I get an error that it doesn't exist. Is this some temporary working directory that is not being cleaned up?

Steps
With the below versions of cargo/git, issue the following commands:

  1. cargo new foo.
  2. cd foo
  3. ls -l

Notes
Here's the relevant transcript of commands indicating what I see, and the versions of relevant tools:

$ cargo --version
cargo 1.37.0-nightly (4c1fa54d1 2019-06-24)

$ rustc --version
rustc 1.37.0-nightly (0af8e872e 2019-06-30)

$ rustup --version
rustup 1.18.3 (435397f48 2019-05-22)

$ ll
total 18
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 09:57 ./
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 09:56 ../
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 09:56 .git/
-rw-r--r-- 1 alex.katechis 1049089  19 Jul 24 09:56 .gitignore
lrwxrwxrwx 1 alex.katechis 1049089   7 Jul 24 09:56 _git2_a08784 -> testing
-rw-r--r-- 1 alex.katechis 1049089 244 Jul 24 09:56 Cargo.toml
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 09:56 src/

# Then I run `rustup update` to get the latest nightly...

$ ll
total 18
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 10:03 ./
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 10:03 ../
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 10:03 .git/
-rw-r--r-- 1 alex.katechis 1049089  19 Jul 24 10:03 .gitignore
lrwxrwxrwx 1 alex.katechis 1049089   7 Jul 24 10:03 _git2_a02928 -> testing
-rw-r--r-- 1 alex.katechis 1049089 240 Jul 24 10:03 Cargo.toml
drwxr-xr-x 1 alex.katechis 1049089   0 Jul 24 10:03 src/

$ cargo --version
cargo 1.38.0-nightly (e3563dbdc 2019-07-16)

$ rustc --version
rustc 1.38.0-nightly (a7f28678b 2019-07-23)

$ git --version
git version 2.19.0.windows.1
@akatechis akatechis added the C-bug Category: bug label Jul 24, 2019
@alexcrichton
Copy link
Member

Hm so I've actually been seeing this for quite some time as well but I figured it was some local issue I hadn't figured out yet. I'm in basically the same situation, and this affects the beta channel as well.

I suspect this is tied to the recent update to libgit2, but for some reason this isn't happening on our CI because it causes issues with tests as well... @ehuss do you know if this is perhaps a bug that was fixed recently in libgit2?

@alexcrichton
Copy link
Member

Oh nvmd, I also possess the power of searching the internet. Looks like this was a bug in libgit2 (libgit2/libgit2#5147) fixed in libgit2/libgit2#5151

alexcrichton added a commit to rust-lang/git2-rs that referenced this issue Jul 24, 2019
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jul 24, 2019
Bring in a few updates, used to update libgit2 and fix a Windows issue
as well as updating the `url` dependencies.

Closes rust-lang#7173
bors added a commit that referenced this issue Jul 25, 2019
Tighten requirements for git2 crates

Bring in a few updates, used to update libgit2 and fix a Windows issue
as well as updating the `url` dependencies.

Closes #7173
@azureskydiver
Copy link

I am still seeing this behavior in version 1.37. I installed rustup-init.exe from the main rust-lang.org site this evening and ran cargo new hello_cargo. A weird "_git2_a22412" directory was created along with the other files and directory described by the Rust book and the cargo manual.

@ehuss
Copy link
Contributor

ehuss commented Aug 26, 2019

@azureskydiver We did not backport the fix to 1.37. Honestly, I didn't think about it, and didn't really expect many people to enable core.symlinks. It should be fixed in 1.38 (beta). You can set git's core.symlinks to false, or just delete the directory in the meantime.

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.

4 participants