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
squashfs: passthrough squashfs compressed layers #1408
Conversation
squashfs blobs are internally compressed, so bypass compression/decompression Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
f012225
to
b0c0a9a
Compare
Ping? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the compression algorithm just be called |
Can it be generic though? Doesn't the test against the squashfs byte header mean that it's squashfs specific? |
In the first place, It’s not immediately obvious that recognizing Squashfs as blob compression format is the right thing to do here — Squashfs is a file format, not a compression format. Maybe we should only compress recognized MIME types, or autodetected and recognized content types. Also consider OCI artifacts, at least conceptually. (This is not an opinion on the PR, I haven’t thought about this carefully yet — this PR might well be the right approach; I’d just like to prevent the discussion from following the “no-op compression” train of thought purely by default, without considering alternatives.) |
According to the OCI spec, we should only be compressing recognized content types. I haven't read the docker spec, but perhaps it has the same mandate? In any case, we have been maintaining a fork with some version of this patch for over two years, and have tried to upstream three different versions of a patchset that would solve the problem for us. It would be great if we could converge on at least one solution. This one is by far the smallest and least invasive of the three. |
Sorry for the bikeshedding. I am fine with the current approach (I am also guilty of adding zstd:chunked that is not a compression format as well :)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the principle of not representing the true state of things, this actually has side effects in copyBlobFromStream
: because isCompressed
is set, this can allow decompression (on decompressed-only transports or copy --dest-decompress
) — and even on a trivial no-op copy, BlobInfo.CompressionAlgorithm
is set, triggering a MIME type update.
And any such update would fail because we have no MIME type mapping for the SquashFS “compression algorithm”.
Right now, for SquashFS-only images, all that is hidden by the layerDigestsDiffer
logic if the layers aren’t modified, but that’s not a reasonable design (e.g. combining a tar layer and a SquashFS layer in one image could trigger these properties on a change of the tar layer).
Testing with the magic numbers changed so that the SquashFS path triggers on ordinary gzip images EDIT and with layerDigestsDiffer
nerfed:
% bin/skopeo --override-os linux copy --debug --insecure-policy docker://quay.io/libpod/busybox dir:t
…
DEBU[0002] GET https://quay.io/v2/libpod/busybox/blobs/sha256:9758c28807f21c13d05c704821fdd56c0b9574912f9b916c65e1df3e6b8bc572
DEBU[0003] Detected compression format squashfs
DEBU[0003] blob sha256:9758c28807f21c13d05c704821fdd56c0b9574912f9b916c65e1df3e6b8bc572 with type application/vnd.docker.image.rootfs.diff.tar.gzip should be compressed with gzip, but compressor appears to be squashfs
DEBU[0003] Using original blob without modification
…
FATA[0003] creating an updated image manifest: preparing updated manifest, layer "sha256:9758c28807f21c13d05c704821fdd56c0b9574912f9b916c65e1df3e6b8bc572": unknown compressed with algorithm squashfs variant for type application/vnd.docker.image.rootfs.diff.tar.gzip
In my experience, such technical debt never disappears (compare the sad history of InternalUnstableUndocumentedMIMEQuestionMark
).
OK, so let’s figure this out.
How’s that for a plan? Now, the infrastructure of creating an internal-only version of While the making internal-only versions of |
As with most plans, it sounds good :). I'll look forward to following #1439. |
I believe this is all now implemented in #1574 : layers in non-image OCI artifacts, and layers with unrecognized MIME types, are not compressed/decompressed. Testing would be appreciated; if something about it doesn’t work, we’d love to hear. |
squashfs blobs are internally compressed, so bypass compression/decompression
This is a follow-up to discussions in:
#947
#957