Skip to content

@std/tar hangs indefinitely unlike @std/archive #6019

Open
@lowlighter

Description

@lowlighter

Describe the bug

Given the following valid archive:

@lowlighter ➜ /tmp $ wget https://github.com/rustwasm/wasm-pack/releases/download/v0.13.0/wasm-pack-v0.13.0-x86_64-unknown-linux-musl.tar.gz
...
@lowlighter ➜ /tmp $ tar -ztvf wasm-pack-v0.13.0-x86_64-unknown-linux-musl.tar.gz 
drwxrwxrwx 0/0               0 2024-07-01 18:54 wasm-pack-v0.13.0-x86_64-unknown-linux-musl/
-rwxrwxrwx 0/0           10850 2024-07-01 18:52 wasm-pack-v0.13.0-x86_64-unknown-linux-musl/LICENSE-APACHE
-rwxrwxrwx 0/0            1059 2024-07-01 18:52 wasm-pack-v0.13.0-x86_64-unknown-linux-musl/LICENSE-MIT
-rwxrwxrwx 0/0            3383 2024-07-01 18:52 wasm-pack-v0.13.0-x86_64-unknown-linux-musl/README.md
-rwxrwxrwx 0/0         6893312 2024-07-01 18:54 wasm-pack-v0.13.0-x86_64-unknown-linux-musl/wasm-pack

Steps to Reproduce

Using new std/tar result in a code stuck (or if it isn't it's way longer than minutes):

import { UntarStream } from "jsr:@std/tar/untar-stream"
const response = await fetch("https://github.com/rustwasm/wasm-pack/releases/download/v0.13.0/wasm-pack-v0.13.0-x86_64-unknown-linux-musl.tar.gz")
const entries = response.body!
    .pipeThrough(new DecompressionStream("gzip"))
    .pipeThrough(new UntarStream())

for await (const entry of entries) {
    console.log(entry.path, entry.header.size)
}
@lowlighter ➜ /workspaces/libs/bundle (archive-to-tar) $ deno --version
deno 1.46.3 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.5-rusty
typescript 5.5.2
@lowlighter ➜ /workspaces/libs/bundle (archive-to-tar) $ deno run -A wasm/test.ts 
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/ 0
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/LICENSE-APACHE 10850
^C

Expected behavior

Using old std/archive/untar works without issues:

import { Untar } from "jsr:@std/archive/untar"
import { readerFromStreamReader } from "jsr:@std/io"

const response = await fetch("https://github.com/rustwasm/wasm-pack/releases/download/v0.13.0/wasm-pack-v0.13.0-x86_64-unknown-linux-musl.tar.gz")
const entries = new Untar(readerFromStreamReader(response.body!
    .pipeThrough(new DecompressionStream("gzip"))
    .getReader()
))

for await (const entry of entries) {
    console.log(entry.fileName, entry.fileSize)
}
@lowlighter ➜ /workspaces/libs/bundle (archive-to-tar) $ deno --version
deno 1.46.3 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.5-rusty
typescript 5.5.2
@lowlighter ➜ /workspaces/libs/bundle (archive-to-tar) $ deno run -A wasm/test.ts 
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/ 0
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/LICENSE-APACHE 10850
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/LICENSE-MIT 1059
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/README.md 3383
wasm-pack-v0.13.0-x86_64-unknown-linux-musl/wasm-pack 6893312

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions