The overlay2 change ensures that the correct path is used to resolve the
symlink. The current code will not fail since the symlinks are always given
a value of "../id/diff" which ends up ignoring the incorrect "link" value.
Fix this code so it doesn't cause unexpected errors in the future if the
symlink changes.
The layerstore cleanup ensures that the empty layer returns a tar stream if
the provided parent is empty. Any value other than empty still returns an
error since the empty layer has no parent. Currently empty layer is not
used anywhere that TarStreamFrom is used but could break in the future if
this function is called.
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
| ... | ... |
@@ -412,7 +412,7 @@ func (d *Driver) getLowerDirs(id string) ([]string, error) {
|
| 412 | 412 |
if err != nil {
|
| 413 | 413 |
return nil, err |
| 414 | 414 |
} |
| 415 |
- lowersArray = append(lowersArray, path.Clean(path.Join(d.home, "link", lp))) |
|
| 415 |
+ lowersArray = append(lowersArray, path.Clean(path.Join(d.home, linkDir, lp))) |
|
| 416 | 416 |
} |
| 417 | 417 |
} else if !os.IsNotExist(err) {
|
| 418 | 418 |
return nil, err |
| ... | ... |
@@ -24,7 +24,10 @@ func (el *emptyLayer) TarStream() (io.ReadCloser, error) {
|
| 24 | 24 |
return ioutil.NopCloser(buf), nil |
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 |
-func (el *emptyLayer) TarStreamFrom(ChainID) (io.ReadCloser, error) {
|
|
| 27 |
+func (el *emptyLayer) TarStreamFrom(p ChainID) (io.ReadCloser, error) {
|
|
| 28 |
+ if p == "" {
|
|
| 29 |
+ return el.TarStream() |
|
| 30 |
+ } |
|
| 28 | 31 |
return nil, fmt.Errorf("can't get parent tar stream of an empty layer")
|
| 29 | 32 |
} |
| 30 | 33 |
|