The `ApplyDiff` function takes a tar archive stream that is
automagically decompressed later. This was causing a double
decompression, and when the layer was empty, that causes an early EOF.
Signed-off-by: Vincent Batts <vbatts@redhat.com>
| ... | ... |
@@ -323,7 +323,7 @@ func (a *Driver) Diff(id, parent string) (archive.Archive, error) {
|
| 323 | 323 |
} |
| 324 | 324 |
|
| 325 | 325 |
func (a *Driver) applyDiff(id string, diff archive.ArchiveReader) error {
|
| 326 |
- return chrootarchive.Untar(diff, path.Join(a.rootPath(), "diff", id), nil) |
|
| 326 |
+ return chrootarchive.UntarUncompressed(diff, path.Join(a.rootPath(), "diff", id), nil) |
|
| 327 | 327 |
} |
| 328 | 328 |
|
| 329 | 329 |
// DiffSize calculates the changes between the specified id |
| ... | ... |
@@ -77,6 +77,7 @@ type Driver interface {
|
| 77 | 77 |
// ApplyDiff extracts the changeset from the given diff into the |
| 78 | 78 |
// layer with the specified id and parent, returning the size of the |
| 79 | 79 |
// new layer in bytes. |
| 80 |
+ // The archive.ArchiveReader must be an uncompressed stream. |
|
| 80 | 81 |
ApplyDiff(id, parent string, diff archive.ArchiveReader) (size int64, err error) |
| 81 | 82 |
// DiffSize calculates the changes between the specified id |
| 82 | 83 |
// and its parent and returns the size in bytes of the changes |
| ... | ... |
@@ -121,7 +121,7 @@ func (gdw *naiveDiffDriver) ApplyDiff(id, parent string, diff archive.ArchiveRea |
| 121 | 121 |
|
| 122 | 122 |
start := time.Now().UTC() |
| 123 | 123 |
logrus.Debugf("Start untar layer")
|
| 124 |
- if size, err = chrootarchive.ApplyLayer(layerFs, diff); err != nil {
|
|
| 124 |
+ if size, err = chrootarchive.ApplyUncompressedLayer(layerFs, diff); err != nil {
|
|
| 125 | 125 |
return |
| 126 | 126 |
} |
| 127 | 127 |
logrus.Debugf("Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
|
| ... | ... |
@@ -411,7 +411,7 @@ func (d *Driver) ApplyDiff(id string, parent string, diff archive.ArchiveReader) |
| 411 | 411 |
return 0, err |
| 412 | 412 |
} |
| 413 | 413 |
|
| 414 |
- if size, err = chrootarchive.ApplyLayer(tmpRootDir, diff); err != nil {
|
|
| 414 |
+ if size, err = chrootarchive.ApplyUncompressedLayer(tmpRootDir, diff); err != nil {
|
|
| 415 | 415 |
return 0, err |
| 416 | 416 |
} |
| 417 | 417 |
|