Skip to content

Commit d3b817b

Browse files
committed
Read trailing data from tar reader
Not reading all the data from the tar reader causes the layer digest mismatch which causes failures during unpack of certain images for lcow. This changes fixes that. Signed-off-by: Amit Barve <[email protected]>
1 parent e4e05c6 commit d3b817b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

diff/lcow/lcow.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package lcow
2121
import (
2222
"context"
2323
"io"
24+
"io/ioutil"
2425
"os"
2526
"path"
2627
"time"
@@ -163,6 +164,11 @@ func (s windowsLcowDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mou
163164
}
164165
outFile.Close()
165166

167+
// Read any trailing data
168+
if _, err := io.Copy(ioutil.Discard, rc); err != nil {
169+
return emptyDesc, err
170+
}
171+
166172
err = security.GrantVmGroupAccess(layerPath)
167173
if err != nil {
168174
return emptyDesc, errors.Wrapf(err, "failed GrantVmGroupAccess on layer vhd: %v", layerPath)

0 commit comments

Comments
 (0)