From 5487881e120e927d7210adf0cb09181092c3ab35 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Mon, 25 Jul 2016 13:28:10 -0700 Subject: [PATCH] Fix calculation of relative path for symlink on docker save Relative paths are now calculated from a base path rather than from the file path, which gets treated like a directory. Symlinks will now properly point to the file as "..//layer.tar" rather the incorrect "../..//layer.tar". Fixes #24951 Signed-off-by: Derek McGowan (github: dmcgowan) --- image/tarexport/save.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/tarexport/save.go b/image/tarexport/save.go index e1a4947d08..ddb87ee954 100644 --- a/image/tarexport/save.go +++ b/image/tarexport/save.go @@ -307,7 +307,7 @@ func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, creat defer layer.ReleaseAndLog(s.ls, l) if oldPath, exists := s.diffIDPaths[l.DiffID()]; exists { - relPath, err := filepath.Rel(layerPath, oldPath) + relPath, err := filepath.Rel(outDir, oldPath) if err != nil { return distribution.Descriptor{}, err }