@std/tar hangs indefinitely unlike @std/archive
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 681
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Given the following valid archive:
```bash
@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):
```ts
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:
```ts
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**
- https://github.com/lowlighter/libs/pull/76
- https://github.com/denoland/std/issues/5986
Contributor guide
Assessment
This issue has not been assessed yet.