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

GitException thrown in ZLibStream (Invalid ZLIB header?) #619

Closed
WildCard65 opened this issue Jun 19, 2021 · 8 comments · Fixed by #621
Closed

GitException thrown in ZLibStream (Invalid ZLIB header?) #619

WildCard65 opened this issue Jun 19, 2021 · 8 comments · Fixed by #621
Assignees
Milestone

Comments

@WildCard65
Copy link

WildCard65 commented Jun 19, 2021

C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly.
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: Nerdbank.GitVersioning.GitException: Exception of type 'Nerdbank.GitVersioning.GitException' was thrown.
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.ZLibStream..ctor(Stream stream, Int64 length) in NerdBank.GitVersioning.dll:token 0x600022e+0x5b
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitObjectStream..ctor(Stream stream, String objectType) in NerdBank.GitVersioning.dll:token 0x6000176+0x0
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.TryGetObjectByPath(GitObjectId sha, String objectType, Stream& value) in NerdBank.GitVersioning.dll:token 0x6000201+0x61
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.TryGetObjectBySha(GitObjectId sha, String objectType, Stream& value) in NerdBank.GitVersioning.dll:token 0x60001fd+0x3b
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.GetObjectBySha(GitObjectId sha, String objectType) in NerdBank.GitVersioning.dll:token 0x60001fc+0xf
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.GetCommit(GitObjectId sha, Boolean readAuthor) in NerdBank.GitVersioning.dll:token 0x60001f8+0x0
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.ManagedGit.GitRepository.GetHeadCommit(Boolean readAuthor) in NerdBank.GitVersioning.dll:token 0x60001f7+0x1e
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.Managed.ManagedGitContext..ctor(String workingDirectory, String dotGitPath, String committish) in NerdBank.GitVersioning.dll:token 0x6000125+0x59
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.GitContext.Create(String path, String committish, Boolean writable) in NerdBank.GitVersioning.dll:token 0x6000048+0x11
C:\Users\lollo\.nuget\packages\nerdbank.gitversioning\3.4.216\build\Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:    at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner() in Nerdbank.GitVersioning.Tasks.dll:token 0x600009e+0x10d
@WildCard65
Copy link
Author

LibGIT2 works (only via nbgv.exe, dotnet build fails with a DLL load error)

@AArnott
Copy link
Collaborator

AArnott commented Jun 19, 2021

My first guess would have been a corrupted file, but that would presumably prevent libgit2 from working. Any ideas, @qmfrederik?

The dotnet build failure with libgit2 is also concerning, and should be tracked in a separate issue that includes the exact error message. Can you file that, @WildCard65 ?

@WildCard65
Copy link
Author

WildCard65 commented Jun 19, 2021

@AArnott The dotnet build failure with libgit2 is fairly simple, PInvoke is failing to find the native DLL, I managed to "solve" it by copying the DLL from MSBuildFull/lib/win32/x64 to MSBuildCore

@rhodosaur
Copy link
Contributor

rhodosaur commented Jun 19, 2021

I am getting the same exception in certain repos from here:

if (zlibHeader[0] != 0x78 || (zlibHeader[1] != 0x01 && zlibHeader[1] != 0x9C))

To me it looks like the zlib header check is just missing a couple of compression level settings. I dug up this table:

Level | Header
1     | 78 01
2     | 78 5E 
3     | 78 5E 
4     | 78 5E 
5     | 78 5E 
6     | 78 9C
7     | 78 DA
8     | 78 DA
9     | 78 DA

I'm getting a value of 78 5E for my repo and therefore it fails. Adding a check for 5E seems to solve the issue for me, but don't know of a way to change the compression level of a git repo, so haven't verified if the same thing works for levels 7-9.

@WildCard65
Copy link
Author

core.compression -1:9

@qmfrederik
Copy link
Contributor

@AArnott It looks like a couple of users are impacted by this.
You've merged #621 which should contain a fix.
Any chance you can push a new 3.4 version to NuGet?

@AArnott
Copy link
Collaborator

AArnott commented Jun 25, 2021

v3.4.220 releasing to nuget.org now.

@AArnott AArnott closed this as completed Jun 25, 2021
@WildCard65
Copy link
Author

@AArnott @qmfrederik I can confirm v3.4.220 fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants