Skip to content

Stop tar example at the end-of-archive marker - #310

Merged
keichi merged 1 commit into
masterfrom
fix-tar-example
Oct 15, 2026
Merged

keichi merged 1 commit into
masterfrom
fix-tar-example

Conversation

@keichi

@keichi keichi commented Oct 15, 2026

Copy link
Copy Markdown
Owner

A tar archive ends with zero-filled blocks, which the example parsed as an extra entry whose fields were all NaN. The loop only terminated because seek(NaN) happened to make the offset invalid.

Stop reading entries when the next block starts with a zero byte. The example now outputs the same 8 entries as tar tvf example/test.tar.

A tar archive ends with zero-filled blocks, which the example parsed as
an extra entry full of NaNs.
@keichi
keichi merged commit 08728d2 into master Oct 15, 2026
8 checks passed
@keichi
keichi deleted the fix-tar-example branch October 15, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant