Skip to content

using: :nounzip formulas fail with misleading "store corruption: invalid gzip header" #442

Description

@cutiechi

Summary

Formulas whose url points to a raw, uncompressed binary (using: :nounzip) cannot be installed. The downloaded file is saved as source.tar.gz and unconditionally run through tar/gzip extraction, producing a misleading store-corruption error:

==> Installing can1357/tap/omp...
==> Resolving dependencies (1 packages)...
    • omp 18.8.6
==> Downloading and installing formulas...

Note: This package can't be installed with zerobrew.
      Error: store corruption: failed to read archive entry: invalid gzip header

      Try installing with Homebrew instead:
      brew install can1357/tap/omp

Environment

  • zerobrew 0.4.0, macOS arm64
  • zb doctor reports ✓ No issues found — the store is not actually corrupted

Reproduction

zb install can1357/tap/omp -v

omp 18.8.6 from can1357/tap declares:

on_macos do
  on_arm do
    url "https://github.com/can1357/oh-my-pi/releases/download/v#{version}/omp-darwin-arm64",
        using: :nounzip
    sha256 "31faa0ee8420a13a783f4ca56d98f974e4a9f9081d269057a099f7eb618d1133"
  end
end

Evidence that the download itself is fine

  • /opt/zerobrew/tmp/build/omp/source.tar.gz is 203 MB and is a Mach-O 64-bit arm64 executable (magic bytes cf fa ed fe), not an archive
  • Its sha256 (31faa0ee…d1133) exactly matches the formula's declared checksum
  • Every attempt fails identically after ~1m20s (the download time), i.e. it deterministically fails at extraction, after a successful download

Root cause

  1. zb_io/src/build/source.rs — non-bottle formulas always download the URL to source.tar.gz and call extract_tarball; the formula's using: annotation is ignored (there is no nounzip handling anywhere in the codebase).
  2. zb_io/src/extraction/extract.rs — detect_compression() only recognises gzip/xz/zstd/zip magic bytes; anything else falls into CompressionFormat::Unknown, whose handler is // Try gzip as fallback → GzDecoder::new(reader) on a non-gzip stream → invalid gzip header.
  3. The store corruption: prefix makes a supported-format gap look like data corruption.

Expected behavior

Either:

  • Support using: :nounzip: skip archive extraction, place the downloaded file directly into the source dir / keg and mark it executable; or
  • Fail clearly: detect the non-archive case and return an explicit "unsupported raw binary download; install with Homebrew" message instead of a store-corruption error.

Scope

Not specific to this tap: any formula that downloads a bare executable via using: :nounzip (increasingly common for tools shipping single-file release binaries) will hit the same failure. Related prior art: #250 (unsupported cask binary artifact shape).

Activity

  1. cachebag commented on Oct 11, 2026

    @cachebag
    Member

    Thanks for this! A PR would be appreciated and welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions