How to write a "from Unix" gzip file in Rust?

Hi,

Background: I am prototyping a portable tool to quickly generate installers, for a variety of operating systems, including macOS. However, the .pkg file that I am generating, is currently triggering installer validation errors in /var/log/install.log. I am trying my best to follow the structure of other installers, so that mine will eventually pass.

One of the interesting differences between my broken .PKG package file, versus other macOS packages in the wild, is how the file CLI utility remarks from Unix for their gzip'ed Payload [cpio] entries, whereas my Payload omits those two words.

Is it possible to coerce flate2 into writing a gzip archive like that? I get the impression that some formal tar wrapper is necessary. Or perhaps some other archive library emits from Unix gzip files by default.

This is probably coming from the operating system field in the gzip header, which you can set using the relevant method in GzBuilder in flate2 - Rust when creating it.

No idea if that is actually the source of your problem or not, but that is likely the thing that file is displaying.

1 Like

Confirmed, thank you. That's one more potential discrepancy accounted for.

To the best of my knowledge, the root cause of the macOS installer generic validation errors appears to be a lack of PAX compatibility in a Payload cpio entry.