Skip to content

feat(archives): add bzip2 interoperability - #2265

Merged
chaliy merged 1 commit into
mainfrom
codex/tar-bzip2
Aug 6, 2026
Merged

chaliy merged 1 commit into
mainfrom
codex/tar-bzip2

Conversation

@chaliy

@chaliy chaliy commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds GNU-compatible bzip2 archive interoperability. tar now creates, lists,
and extracts bzip2 archives through j, old-style/clustered flags, and
--bzip2, including stdin/stdout and .tar.bz2/.tbz2 workflows. Adds
byte-native bzip2, bunzip2, and bzcat commands with compatible file and
pipeline behavior.

Compressed input and output are covered by request budgets, pre-growth memory
charging, expansion-ratio limits, archive/file quotas, traversal checks, and
closed failure handling for truncation, corruption, and CRC errors.

Why

Bashkit tar could only interoperate with plain and gzip archives, leaving common
GNU tar bzip2 workflows and standalone bzip2 pipelines unsupported.

Before / After

Before:

$ tar -cjf archive.tar.bz2 file
tar: invalid option -- 'j'

After (end-to-end Bashkit CLI smoke):

$ tar -cjf /tmp/archive.tar.bz2 -C /src p.txt
$ tar -tjf /tmp/archive.tar.bz2
p.txt
$ tar -xjf /tmp/archive.tar.bz2 -C /dst && cat /dst/p.txt
smoke payload
$ printf standalone | bzip2 -c | bzcat
standalone

System tar/bzip2 differential tests verify both directions.

Risk

  • Medium
  • Archive argument parsing and decompression process untrusted binary input.
    Existing tar/gzip behavior remains covered; new bomb, corruption, traversal,
    quota, memory, and cross-tool tests exercise the added path.

Checklist

  • Tests added or updated
  • Backward compatibility considered

Validation: just pre-pr, WASM no-default-feature check, cargo-deny license and
advisory checks, archive benchmark, and CLI smoke test all pass.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit eb61d8d Commit Preview URL

Branch Preview URL
Aug 06 2026, 01:35 AM

@chaliy
chaliy force-pushed the codex/tar-bzip2 branch 2 times, most recently from 62a0611 to 8652318 Compare August 6, 2026 01:16
@chaliy
chaliy merged commit b629299 into main Aug 6, 2026
46 checks passed
@chaliy
chaliy deleted the codex/tar-bzip2 branch August 6, 2026 01:47
chaliy added a commit that referenced this pull request Aug 6, 2026
#2264 moved `ctx.execution_budget()` behind `ExecutionCapability`, and
#2265 added bzip2 call sites against the old `Option<&ExecutionBudget>`
shape. Each was green against its own base; together they don't compile,
so `main` is broken.

Decompression meters the budget incrementally as it streams, so it needs
the budget itself rather than a consume/lease call. `with_budget` gives
it one for the duration of a closure, alongside the existing
consume/lease helpers, so the borrow stays inside a checked scope and a
revoked execution reports `Cancelled` instead of handing out a live
reference. The stdout lease site folds into the `lease_budget_bytes`
helper that already existed.

Bundled here rather than split out because it blocks this branch's CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant