Commit 420d802
committed
Match docker cp entry naming and compression for tar streams
The stream copyOut path reused archiveDirectory for directories, which emits a
leading "./" and names entries relative to the directory itself, and always
compressed with gzip. Docker and podman name entries relative to the source's
parent, so the source's own basename is the top level entry, and emit an
uncompressed tar.
The difference is visible in a round trip: with contents-relative naming,
`cp ctr:/dir - | cp - other:/dest` scatters dir's children into /dest instead
of producing /dest/dir. The gzip framing also breaks consumers that read the
stream with a plain tar reader rather than shelling out to tar.
Use the parent-relative form for both files and directories whenever
request.isArchive marks the stream path, with no compression filter. The
internal directory copyOut, where isArchive is derived from the path being a
directory, keeps shipping pax+gzip of the directory's contents, which is what
the host side extracts into the destination directory.1 parent 35f5d9b commit 420d802
1 file changed
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
601 | | - | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
602 | 609 | | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
| 610 | + | |
608 | 611 | | |
609 | | - | |
610 | | - | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
611 | 615 | | |
612 | 616 | | |
613 | 617 | | |
| |||
0 commit comments