WSL: WSL2 corrupts the git index on a mounted file system
Windows Version
Microsoft Windows [Version 10.0.26120.670]
WSL Version
2.2.4.0
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
5.15.153.1-2
Distro Version
Ubuntu 24.04 (also reproes on Ubuntu 22.04, openSUSE Leap 15.4, 15.5, and Tumbleweed)
Other Software
git
Repro Steps
Unfortunately it doesn’t repro with smaller repos. But it consistently reproes with this particular repo. The key part is that the repo is stored on a mounted Windows drive.
mkdir /mnt/c/src - anywhere on the Windows C: drive
cd /mnt/c/src
git clone https://github.com/zlatko-michailov/abc.git - use this particular repo
git checkout dev
git status - should be clean
git reset --hard HEAD - this is the one that breaks it
Expected Behavior
git status - should be clean
ls -al .git - all files should appear normal
Actual Behavior
git status - all files from the repo appear as deleted
ls -al .git - index (always) and ORIG_HEAD (sometimes) appear as ???
This doesn’t repro when the repo is stored in the WSL’s own Linux file system.
Diagnostic Logs
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (6 by maintainers)
Assuming you have MDE plug-in for WSL installed. You can update to the version 1.24.605.1 or later from here to resolve the issue. https://www.catalog.update.microsoft.com/Search.aspx?q=wsl
Confirmation that updating the Microsoft Defender for Endpoint plug-in for Windows Subsystem for Linux (WSL) to version
>= 1.24.605.1solves the issue.Update - I worked with the WSL team. They located the source of the issue, which appears to be outside of WSL. The owning team confirmed they were able to repro, and they started working on a fix.
I was able to repro the regression only on Windows Insider builds. I couldn’t repro it on a regular Windows build. So, if you can use a machine with a regular Windows build, or switch Windows channels, you can continue working until a fix rolls out.
Thanks! I can confirm.
Back to my regularly scheduled magit. 😃
Closing.
I was notified today that the bug has been fixed, and I confirm that I can no longer repro it. So, I’m closing this issue.
You may need to run
Windows Updatesto get the fix, if you haven’t done so today.Yes, I forgot to mention that it started happening about 2 weeks ago. Please check what flights and updates have been rolled out.