Skip to content

Commit

Permalink
Read trailing data from tar reader
Browse files Browse the repository at this point in the history
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 <ambarve@microsoft.com>
(cherry picked from commit d3b817b)
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
  • Loading branch information
ambarve authored and kevpar committed Oct 26, 2020
1 parent 013411a commit 88e7f23
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions diff/lcow/lcow.go
Expand Up @@ -21,6 +21,7 @@ package lcow
import (
"context"
"io"
"io/ioutil"
"os"
"path"
"time"
Expand Down Expand Up @@ -163,6 +164,11 @@ func (s windowsLcowDiff) Apply(ctx context.Context, desc ocispec.Descriptor, mou
}
outFile.Close()

// Read any trailing data
if _, err := io.Copy(ioutil.Discard, rc); err != nil {
return emptyDesc, err
}

err = security.GrantVmGroupAccess(layerPath)
if err != nil {
return emptyDesc, errors.Wrapf(err, "failed GrantVmGroupAccess on layer vhd: %v", layerPath)
Expand Down

0 comments on commit 88e7f23

Please sign in to comment.