-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
Milestone
Description
Description
Hit a FormatException
when extracting a .tar.gz file. I ran into this using the work item extraction I recently added to runfo: jaredpar/runfo#152
Reproduction Steps
Download https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.5-servicing.22213.9/dotnet-runtime-6.0.5-osx-x64.tar.gz.
Pass this to TarFile.ExtractToDirectory
, eg:
TarFile.ExtractToDirectory(@"c:\scratch\aspnetrepro\correlation-payload\dotnet-runtime-6.0.5-osx-x64.tar.gz", @".\", true);
Expected behavior
Successfully extracts tar file
Actual behavior
Unhandled exception. System.FormatException: Could not find any recognizable digits.
at System.ParseNumbers.StringToInt(ReadOnlySpan`1 s, Int32 radix, Int32 flags, Int32& currPos)
at System.Convert.ToInt32(String value, Int32 fromBase)
at System.Formats.Tar.TarHelpers.GetTenBaseNumberFromOctalAsciiChars(Span`1 buffer)
at System.Formats.Tar.TarHeader.TryReadCommonAttributes(Span`1 buffer)
at System.Formats.Tar.TarHeader.TryGetNextHeader(Stream archiveStream, Boolean copyData)
at System.Formats.Tar.TarReader.TryGetNextEntryHeader(TarHeader& header, Boolean copyData)
at System.Formats.Tar.TarReader.GetNextEntry(Boolean copyData)
at System.Formats.Tar.TarFile.ExtractToDirectoryInternal(Stream source, String destinationDirectoryPath, Boolean overwriteFiles, Boolean leaveOpen)
at System.Formats.Tar.TarFile.ExtractToDirectory(String sourceFileName, String destinationDirectoryName, Boolean overwriteFiles)
Regression?
No
Known Workarounds
No response
Configuration
.NET 7.0 preview 5, windows 11
Other information
No response