1
0
mirror of https://github.com/containers/buildah.git synced 2025-11-14 20:42:31 +03:00
Files
buildah/commit.go
Nalin Dahyabhai 9ff37b0cf0 shallowCopy: avoid a second read of the container's layer
Avoid reading the container's layer a second time in shallowCopy (after
the first time it's read, in NewImageSource()).

Our second copy of the diff isn't going to match the first one if it's
of any serious size, because when NaiveDiff is used to generate the
diff, whiteout entries have their times set to "now", rather than a
fixed value, which causes both the uncompressed and compressed digests
to differ from what NewImageSource() records in the manifest.

Instead, use the generic manifest-reading API that the image library
now provides to read the layer info list and the config blob info, and
use their values to PutBlob() them to the destination image.

We can probably drop shallowCopy() completely, since the newer version
of the image library has a more reliable HasBlob(), which should save us
the time that shallowCopy() was originally meant to save, but we should
probably consider the use of compression for this code path as part of
that, too.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #506
Approved by: rhatdan
2018-03-04 15:26:24 +00:00

10 KiB