sylabs / oci-tools

Go module for working with OCI container images.
Apache License 2.0
2 stars 3 forks source link

fix: Squash hard link/opaque whiteout handling #38

Closed tri-adam closed 6 months ago

tri-adam commented 6 months ago

Improve mutate.Squash so that it handles opaque whiteouts and hard links.

Prior to this PR, oci-tools relied on Extract from the github.com/google/go-containerregistry (GGCR) module. Unfortunately, Extract has a couple of known issues:

Fixing these is not trivial due to the way the GGCR code works. The original code reads the layers in reverse order, allowing it to handle files that are modified/deleted efficiently, since the "upper" layer content is always read first. Although this works well in the vast majority of cases, the bugs above highlight some of the challenges:

To work around these issues, the proposed code here:

tri-adam commented 6 months ago

Thanks @dtrudg! Ready for another pass...