Skip to content

archive/zip: Writer produces zip files unreadable by the OS X Finder's extractor #3252

Description

@adg
Add the following test to writer_test.go and run "go test -run=Disk". It
produces the file $HOME/test.zip. Try to extract that by opening it from Finder. I get
"Error 2 - no such file or directory."

I can't remember whether this ever worked, or whether it was something that broke
recently. I backed up past some recent changes to fd7f2a4b69a9 and it is still broken.

Any help with this would be most appreciated. Marking as Priority-Go1 but it's not a
release blocker.

func TestWriterDisk(t *testing.T) {
    largeData := make([]byte, 1<<17)
    for i := range largeData {
        largeData[i] = byte(rand.Int())
    }
    writeTests[1].Data = largeData
    defer func() {
        writeTests[1].Data = nil
    }()

    // write a zip file
    f, err := os.Create(os.GetEnv("HOME") + "/test.zip")
    if err != nil {
        t.Fatal(err)
    }
    defer f.Close()
    w := NewWriter(f)

    for _, wt := range writeTests {
        testCreate(t, w, &wt)
    }

    if err := w.Close(); err != nil {
        t.Fatal(err)
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions