Skip to content

Commit 906452d

Browse files
committed
Merge branch 'main' into revert-2767-cklin/prefer-gtar
2 parents 0656d7f + 1bb15d0 commit 906452d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Diff for: lib/tar.js

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/tar.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/tar.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,16 @@ export async function extractTarZst(
152152

153153
try {
154154
// Initialize args
155-
const args = ["-x", "--zstd"];
155+
//
156+
// `--ignore-zeros` means that trailing zero bytes at the end of an archive will be read
157+
// by `tar` in case a further concatenated archive follows. Otherwise when a tarball built
158+
// by GNU tar, which writes many trailing zeroes, is read by BSD tar, which expects less, then
159+
// BSD tar can hang up the pipe to its filter program early, and if that program is `zstd`
160+
// then it will try to write the remaining zeroes, get an EPIPE error because `tar` has closed
161+
// its end of the pipe, return 1, and `tar` will pass the error along.
162+
//
163+
// See also https://github.com/facebook/zstd/issues/4294
164+
const args = ["-x", "--zstd", "--ignore-zeros"];
156165

157166
if (tarVersion.type === "gnu") {
158167
// Suppress warnings when using GNU tar to extract archives created by BSD tar

0 commit comments

Comments
 (0)