Invalid TAR end

Open
#62 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Domain
tooling

Research direction

Start with the provided Main entry point and reproduce the failure using format.tar.Writer and Reader, varying the first file size as shown. Inspect the TAR reader and writer behavior around the generated end marker; done when the example reads both entries successfully for the reported sizes.

Written by the indexing model from the issue text.

Description

import format.tar.*;
import haxe.io.*;

using Lambda;

class Main {
    static function main() {
        function file(name:String, bytes:Bytes) return {
            fileName: name,
            fileSize: bytes.length,
            fileTime: Date.now(),
            fmod: 666,
            uid: 1,
            gid: 1,
            uname: 'u',
            gname: 'g',
            data: bytes,
        }
        
        var data = [
            file('folder/file1.txt', Bytes.alloc(4096)), // fails if: 1024, 2048, 4096, 512000, etc...
            file('folder/file2.txt', Bytes.alloc(1)),
        ].list();
        
        var output = new BytesOutput();
        new Writer(output).write(data);
        var entries = new Reader(new BytesInput(output.getBytes())).read();
        for(file in entries) trace(file.fileName, file.fileSize);
    }
}

Trying to tar some files, if the first file size is of some magic numbers, it fails to untar with Invalid TAR end

Dominant language
Haxe
Stars
141
Forks
65
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HaxeFoundation/format

All issues in HaxeFoundation/format

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.