Weird symlink created by cargo

I'm a complete beginner with Rust. In fact, I just installed it about 15 minutes ago from the rust-lang.org main site, and I'm working my way through the book. I'm running on Windows 10, build 1903. I have cargo 1.37.0 (9edd08916 2019-08-02). I have git version 2.23.0.windows.1.

When I run cargo new hello_cargo, it creates a "hello_cargo" folder with files as described in the book, as well as a git repository as described by the manual. What I'm finding unexpected though, is that there is an extra directory named "_git2_a22412". It looks like it is symlink directory based on the attributes shown by PowerShell, CMD, as well as the Windows Explorer. Unfortunately, trying to follow the link gives me an error message like:

    ls : Could not find a part of the path 'C:\z\rust_projects\hello_cargo\_git2_a22412'.
    At line:1 char:1
    + ls
    + ~~
        + CategoryInfo          : ReadError: (C:\z\rust_proje...go\_git2_a22412:String) [Get-ChildItem], DirectoryNotFound
       Exception
        + FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand

Trying to delete the directory fails with:

    Remove-Item : There is a mismatch between the tag specified in the request and the tag present in the reparse point
    At line:1 char:1
    + Remove-Item .\_git2_a22412\ -Force -Recurse
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Remove-Item], Win32Exception
        + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand

I've tried blowing away the "hello_cargo" directory and trying again in CMD instead of PowerShell and I got the same results (with a different random suffix after "_git2").

I would appreciate any recommendations on how to fix this issue.

Usually when it comes to weird symlink stuff or missing files or permissions, explorer is actually alot easier to use (Albeit a slowdown when going on the command prompt or powershell). Try deleting it through explorer.

But before you do that, because this sounds like a bug, try posting an issue onto rust-lang/cargo to see if it's an issue with cargo or with git or with your setup.

PS. Welcome to the rust users forum! It's good to see new people starting rust!

Yep. I had to use Explorer to blow the directory away. PowerShell and CMD were having issues.

I'll go check the bug list and enter a new one if nothing jumps out as dupe for me.

1 Like

The issue was marked as fixed on 7/25/2019 with fix merged into master that same day:

Unfortunately, it looks like there maybe a regression on the libgit2. Anyway, I put in a comment in the same issue in the hopes that someone sees it.

2 Likes

This wasn't a regression in libgit2. The fix was merged into master for 1.38, but not back ported to 1.37. As noted above, I have 1.37.