podup cp payload/. SERVICE:/tmp should copy the contents of payload into /tmp, the way docker cp and podman cp treat a source ending in /.. It copies the directory itself instead, and the files land in /tmp/payload/.
Why
pack_path in internal/engine/copy/archive.rs names the archive's top entry with src.file_name(). Rust's Path drops a trailing . component, so Path::new("payload/.").file_name() is Some("payload"), and the tree is packed under payload/. Nothing on the way from the CLI to pack_path handles the /. suffix: I searched for it and found no match.
I found this by reading, during a review of #1790, and have not run it against a container yet. It is not introduced by #1790; it is on develop today.
What the fix needs
- Detect the trailing
/. on the source as written, before it becomes a Path, since the Path has already lost it.
- Pack the directory's children at the top of the archive rather than under the directory's name.
- A live test in
tests/engine_integration/cp_flags.rs that copies payload/. and asserts the files are at /tmp/a.txt, not /tmp/payload/a.txt, plus the same for the host direction if cp SERVICE:/path/. host has the same shape.
podup cp payload/. SERVICE:/tmpshould copy the contents ofpayloadinto/tmp, the waydocker cpandpodman cptreat a source ending in/.. It copies the directory itself instead, and the files land in/tmp/payload/.Why
pack_pathininternal/engine/copy/archive.rsnames the archive's top entry withsrc.file_name(). Rust'sPathdrops a trailing.component, soPath::new("payload/.").file_name()isSome("payload"), and the tree is packed underpayload/. Nothing on the way from the CLI topack_pathhandles the/.suffix: I searched for it and found no match.I found this by reading, during a review of #1790, and have not run it against a container yet. It is not introduced by #1790; it is on
developtoday.What the fix needs
/.on the source as written, before it becomes aPath, since thePathhas already lost it.tests/engine_integration/cp_flags.rsthat copiespayload/.and asserts the files are at/tmp/a.txt, not/tmp/payload/a.txt, plus the same for the host direction ifcp SERVICE:/path/. hosthas the same shape.