buildah icon indicating copy to clipboard operation
buildah copied to clipboard

why is copying required twice during buildah commit?

Open lddlww opened this issue 1 month ago • 4 comments

reference follow codes: 1: write to /var/tmp/buildahxxx https://github.com/containers/buildah/blob/e0e108c7cc17c4ccb443fb25c93675934b62378e/image.go#L1110

2: copy blob, write to /var/tmp/container_storagexxx https://github.com/containers/buildah/blob/e0e108c7cc17c4ccb443fb25c93675934b62378e/vendor/go.podman.io/image/v5/storage/storage_dest.go#L295

if first one exe io.Copy why second code used Copy too,does it instead of os.Rename?

above what would lead poor performance , or am i missing something?

lddlww avatar Oct 31 '25 08:10 lddlww

io.Copy() doesn't manipulate the filesystem. https://pkg.go.dev/io#Copy describes its behavior.

nalind avatar Nov 03 '25 16:11 nalind

does storage_dest.go putBlobToPendingFile func could add extra parameter which is /var/tmp/buildahxxx/sha256xxxx, so that , putBlobToPendingFile func need not do io.Copy and digest?

storage_dest.go putBlobToPendingFile func do io.Copy only if /var/tmp/buildahxxx/sha256xxxx not exists

lddlww avatar Nov 04 '25 08:11 lddlww

That logic is maintained in the https://github.com/containers/container-libs repository, and tbh it's been some time since I last looked at the details of it. If there's an optimization to be made there, that's where the pull request would be filed.

nalind avatar Nov 04 '25 17:11 nalind

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Dec 05 '25 00:12 github-actions[bot]