buildah
buildah copied to clipboard
buildah copy --parents leaks host ancestor directories into the copied image
Issue Description
When working on PR #7157 I was going to add a test using --include and --required-path with --parents and noticed that buildah copy --parents is also copying the ancestor directories above the pivot point, i.e. real host filesystem path components like /tmp/parents_bug into the image as actual directory entries. I did confirm this against main
Steps to reproduce the issue
mkdir -p /tmp/parent_bug/mytest/x
touch /tmp/parent_bug/mytest/x/a.txt
cid=$(buildah from scratch)
buildah copy --parents "$cid" /tmp/parent_bug/mytest/./x/a.txt /parents/
buildah unshare bash -c "
mnt=\$(buildah mount $cid)
find \"\$mnt\" -printf '%P\n' | sort
buildah umount $cid"
Describe the results you received
parents
parents/tmp
parents/tmp/parent_bug
parents/x
parents/x/a.txt
606bd4dd938f390b4e5fae48819f34fb23440442e194af6cd32847d280477c1c
Describe the results you expected
parents
parents/x
parents/x/a.txt
606bd4dd938f390b4e5fae48819f34fb23440442e194af6cd32847d280477c1c
buildah version output
buildah version
Version: 1.46.0-dev
Go Version: go1.26.8-X:nodwarf5
Image Spec: 1.1.1
Runtime Spec: 1.3.0
image Version: 5.42.0-dev
Git Commit: e293f47f94a93b86a19a2defed544800ebb28afa
Built: Wed Oct 14 15:12:16 2026
OS/Arch: linux/amd64
BuildPlatform: linux/amd64
buildah info output
{
"cdi": {
"classes": [],
"devices": {},
"directories": [
"/etc/cdi",
"/var/run/cdi"
],
"vendors": {}
},
"host": {
"Distribution": {
"distribution": "fedora",
"version": "44"
},
"MemFree": 31737987072,
"MemTotal": 65965408256,
"OCIRuntime": "crun",
"SwapFree": 8316678144,
"SwapTotal": 8589930496,
"arch": "amd64",
"cpus": 16,
"hostname": "jarrevil-thinkpadp16vgen1.boston.csb",
"kernel": "7.1.10-200.fc44.x86_64",
"os": "linux",
"rootless": true,
"uptime": "29h 56m 34.39s (Approximately 1.21 days)",
"variant": ""
},
"store": {
"ContainerStore": {
"number": 11
},
"GraphDriverName": "overlay",
"GraphImageStore": "",
"GraphOptions": null,
"GraphRoot": "/home/jarrevil/.local/share/containers/storage",
"GraphStatus": {
"Backing Filesystem": "btrfs",
"Native Overlay Diff": "true",
"Supports d_type": "true",
"Supports shifting": "false",
"Supports volatile": "true",
"Using metacopy": "false"
},
"GraphTransientStore": false,
"ImageStore": {
"number": 5
},
"RunRoot": "/run/user/4219700/containers"
}
}
Provide your storage.conf
[storage]
runroot = "/run/user/4219700/containers"
graphroot = "/home/jarrevil/.local/share/containers/storage"
Upstream Latest Release
Yes
Additional environment details
Additional environment details
Additional information
Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting
/assign