-
Notifications
You must be signed in to change notification settings - Fork 497
Open
Description
Using the following code on this archive will result in incomplete iteration of the archive, and the exception being thrown
string desktopEntriesArchiveFile = Path.Combine(Path.Combine(Program.BaseDirectoryInternal, "data"), "desktop_entries.tar");
using (var extractor = TarArchive.Open(desktopEntriesArchiveFile))
{
using (var reader = extractor.ExtractAllEntries())
{
var readEntries = 0;
while (reader.MoveToNextEntry())
{
Trace.WriteLine($"Processing entry {readEntries++}: {reader.Entry.Key}");
if (reader.Entry.IsDirectory)
continue;
using (var ms = new MemoryStream())
{
reader.WriteEntryTo(ms);
}
}
if (readEntries != extractor.Entries.Count())
{
throw new Exception("Tar archive read entries count mismatch.");
}
}
}This however, works fine.
string desktopEntriesArchiveFile = Path.Combine(Path.Combine(Program.BaseDirectoryInternal, "data"), "desktop_entries.tar");
using (var extractor = TarArchive.Open(desktopEntriesArchiveFile))
{
var readEntries = 0;
foreach (var entry in extractor.Entries)
{
Trace.WriteLine($"Processing entry {readEntries++}: {entry.Key}");
if (entry.IsDirectory)
continue;
using (var ms = new MemoryStream())
{
entry.WriteTo(ms);
}
}
if (readEntries != extractor.Entries.Count())
{
throw new Exception("Tar archive read entries count mismatch.");
}
}The archive was created on Windows using busybox tar
Using SharpCompress 0.41.0 with .NET 4.8
The issue does not occur with SharpCompress 0.40.0
Possibly related: Streamed gzip data fails to decompress due to checksum issue on 0.40, but fixed on latest.
Copilot
Metadata
Metadata
Assignees
Labels
No labels