Skip to content

copy-preserving-extended-attributes: use a different base image #5901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/copy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ stuff/mystuff"
@test "copy-preserving-extended-attributes" {
createrandom ${TEST_SCRATCH_DIR}/randomfile
# if we need to change which image we use, any image that can provide a working setattr/setcap/getfattr will do
image="quay.io/libpod/systemd-image:20240124"
image="quay.io/libpod/ubuntu"
if ! which setfattr > /dev/null 2> /dev/null; then
skip "setfattr not available, unable to check if it'll work in filesystem at ${TEST_SCRATCH_DIR}"
fi
Expand All @@ -486,7 +486,8 @@ stuff/mystuff"
_prefetch $image
run_buildah from --quiet $WITH_POLICY_JSON $image
first="$output"
run_buildah run $first microdnf -y install /usr/bin/setfattr /usr/sbin/setcap
run_buildah run $first apt-get -y update
run_buildah run $first apt-get -y install attr libcap2-bin
run_buildah copy $first ${TEST_SCRATCH_DIR}/randomfile /
# set security.capability
run_buildah run $first setcap cap_setuid=ep /randomfile
Expand All @@ -495,7 +496,8 @@ stuff/mystuff"
# copy the file to a second container
run_buildah from --quiet $WITH_POLICY_JSON $image
second="$output"
run_buildah run $second microdnf -y install /usr/bin/getfattr
run_buildah run $second apt-get -y update
run_buildah run $second apt-get -y install attr
run_buildah copy --from $first $second /randomfile /
# compare what the extended attributes look like. if we're on a system with SELinux, there's a label in here, too
run_buildah run $first sh -c "getfattr -d -m . --absolute-names /randomfile | grep -v ^security.selinux | sort"
Expand Down