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>
| ... | ... |
@@ -332,6 +332,9 @@ func RebaseArchiveEntries(srcContent io.Reader, oldBase, newBase string) io.Read |
| 332 | 332 |
} |
| 333 | 333 |
|
| 334 | 334 |
hdr.Name = strings.Replace(hdr.Name, oldBase, newBase, 1) |
| 335 |
+ if hdr.Typeflag == tar.TypeLink {
|
|
| 336 |
+ hdr.Linkname = strings.Replace(hdr.Linkname, oldBase, newBase, 1) |
|
| 337 |
+ } |
|
| 335 | 338 |
|
| 336 | 339 |
if err = rebasedTar.WriteHeader(hdr); err != nil {
|
| 337 | 340 |
w.CloseWithError(err) |