mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
Fix docker cp dir with hard link
docker run --name=test ubuntu /bin/sh -c "cd /tmp && echo hi > a && ln a b" && docker cp test:/tmp tmp_ test link /root/tmp/a /root/tmp_/b: no such file or directory Signed-off-by: yangshukui <yangshukui@huawei.com> Upstream-commit: d58ffa0364c04d03a8f25704d7f0489ee6cd9634 Component: engine
This commit is contained in:
@@ -332,6 +332,9 @@ func RebaseArchiveEntries(srcContent io.Reader, oldBase, newBase string) io.Read
|
||||
}
|
||||
|
||||
hdr.Name = strings.Replace(hdr.Name, oldBase, newBase, 1)
|
||||
if hdr.Typeflag == tar.TypeLink {
|
||||
hdr.Linkname = strings.Replace(hdr.Linkname, oldBase, newBase, 1)
|
||||
}
|
||||
|
||||
if err = rebasedTar.WriteHeader(hdr); err != nil {
|
||||
w.CloseWithError(err)
|
||||
|
||||
Reference in New Issue
Block a user