summaryrefslogtreecommitdiff
path: root/test/system/065-cp.bats
diff options
context:
space:
mode:
Diffstat (limited to 'test/system/065-cp.bats')
-rw-r--r--test/system/065-cp.bats21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats
index eda04611f..5778eb46e 100644
--- a/test/system/065-cp.bats
+++ b/test/system/065-cp.bats
@@ -114,7 +114,7 @@ load helpers
}
-@test "podman cp file from host to container and check ownership" {
+@test "podman cp (-a=true) file from host to container and check ownership" {
srcdir=$PODMAN_TMPDIR/cp-test-file-host-to-ctr
mkdir -p $srcdir
content=cp-user-test-$(random_string 10)
@@ -129,6 +129,25 @@ load helpers
run_podman rm -f cpcontainer
}
+@test "podman cp (-a=false) file from host to container and check ownership" {
+ local tmpdir="${PODMAN_TMPDIR}/cp-test-file-host-to-ctr"
+ mkdir -p "${tmpdir}"
+
+ pushd "${tmpdir}"
+ touch a.txt
+ tar --owner=1042 --group=1043 -cf a.tar a.txt
+ popd
+
+ userid=$(id -u)
+
+ run_podman run --user="$userid" --userns=keep-id -d --name cpcontainer $IMAGE sleep infinity
+ run_podman cp -a=false - cpcontainer:/tmp/ < "${tmpdir}/a.tar"
+ run_podman exec cpcontainer stat -c "%u:%g" /tmp/a.txt
+ is "$output" "1042:1043" "copied file retains uid/gid from the tar"
+ run_podman kill cpcontainer
+ run_podman rm -f cpcontainer
+}
+
@test "podman cp file from/to host while --pid=host" {
if is_rootless && ! is_cgroupsv2; then