-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@std/tar: untar_stream
fails to extract a macos archive with "archive entry has invalid header checksum"
#6083
Comments
This might be the same bug that was fixed here #6064. Said fix just hasn't been released on JSR yet. |
I checked and #6064 is merged and part of v0.1.2 on jsr but the header checksum is still present.
Steps to reproduce:
import { UntarStream } from "@std/tar/untar-stream";
import { dirname, normalize } from "@std/path";
for await (
const entry of (await Deno.open("./CHANGE_ME.tar.gz"))
.readable
.pipeThrough(new DecompressionStream("gzip"))
.pipeThrough(new UntarStream())
) {
const path = normalize(entry.path);
await Deno.mkdir(dirname(path));
await entry.readable?.pipeTo((await Deno.create(path)).writable);
} $ deno run --allow-write --allow-read untar.ts
error: Uncaught (in promise) SyntaxError: Cannot extract the tar archive: An archive entry has invalid header checksum
throw new SyntaxError(
^
at UntarStream.#untar (https://jsr.io/@std/tar/0.1.2/untar_stream.ts:241:15)
at eventLoopTick (ext:core/01_core.js:175:7)
at async ReadableStreamDefaultController.<anonymous> (ext:deno_web/06_streams.js:5211:19) |
@tstachl are you sure you're using v0.1.2 because I tested it with the original archive mentioned and it worked fine for me. |
@BlackAsLight yes, I'm using v0.1.2 {
"imports": {
"@std/path": "jsr:@std/path@^1.0.6",
"@std/tar": "jsr:@std/tar@^0.1.2"
}
} And I just downloaded the original file and tested it with that as well: import { UntarStream } from "@std/tar/untar-stream";
import { dirname, normalize } from "@std/path";
for await (
const entry of (await Deno.open("./cndi-mac.tar.gz"))
.readable
.pipeThrough(new DecompressionStream("gzip"))
.pipeThrough(new UntarStream())
) {
const path = normalize(entry.path);
await Deno.mkdir(dirname(path));
await entry.readable?.pipeTo((await Deno.create(path)).writable);
} deno run --allow-write --allow-read tasks/download.ts
error: Uncaught (in promise) SyntaxError: Cannot extract the tar archive: An archive entry has invalid header checksum
throw new SyntaxError(
^
at UntarStream.#untar (https://jsr.io/@std/tar/0.1.2/untar_stream.ts:241:15)
at eventLoopTick (ext:core/01_core.js:175:7)
at async ReadableStreamDefaultController.<anonymous> (ext:deno_web/06_streams.js:5211:19) |
Let me know if there is any additional debugging that I can provide. |
I'm not sure why you'd have a different outcome compared to me for the same code, or how to proceed from here |
@BlackAsLight it works now for the archive mentioned in the original post, I must have had the older version cached, but it still doesn't work for this one: https://github.com/themesberg/flowbite-icons/archive/refs/tags/v1.3.0.tar.gz Any chance you can try it with this one and let me know if that works for you? |
This tar file seems to be encoded with the "Pax Interchange Format" and not the "POSIX ustar Format". |
Good to know, thank you for checking! |
The archive is https://github.com/polyseam/cndi/releases/download/v2.20.0/cndi-mac.tar.gz
and it is generated with deno compile:
ie:
deno task build
https://github.com/polyseam/cndi/blob/747d14b16779e761c05d80917c8fc141cdae259b/deno.json#L18
std/tar/untar_stream.ts
Line 242 in ea85486
The text was updated successfully, but these errors were encountered: