mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-07 21:22:04 +00:00
TarArchive fails to find subsequent entries if you open an entry stream during entry iteration #402
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DannyBoyk on GitHub (Jul 1, 2020).
We usually use TarReader, not TarArchive, so we hadn't seen this before. When using TarArchive (directly or from ArchiveFactory), if you open an entry stream while iterating over the entries, TarArchive fails to find the next header and silently indicates there are no more entries. The follow code will demonstrate this with any TAR archive of more than one file.
I stepped through the source and
TarHeaderFactory.ReadHeaderfails silently for the second entry in the archive. Without debugging further, it appears the archive is someone losing its position due to opening the entry stream. If you don't open the stream, all the entries are iterated over just fine.