opencontainers / image-tools

OCI Image Tooling
https://opencontainers.org
Apache License 2.0
271 stars 82 forks source link

unpacking tools don't preserve mtime #74

Open cyphar opened 8 years ago

cyphar commented 8 years ago

If you call image.CreateRuntimeBundleLayout twice on the same image with the same ref, all of the files will have different mtimes (and ctimes I also believe). You can check this with gomtree.

% oci-create-runtime-bundle --ref latest opensuse/ bundle1/
% sleep 30s
% oci-create-runtime-bundle --ref latest opensuse/ bundle2/
% gomtree -p bundle1/rootfs -c -K sha256digest > bundle1.mtree
"var/lib/ca-certificates/pem/930ac5d2.0": keyword "time": expected 1478385237.839344065; got 1478385246.227449545
"etc/pam.d/common-auth-pc": keyword "time": expected 1478385236.831331389; got 1478385245.223436920
"lib64/libnss_compat.so.2": keyword "time": expected 1478385236.927332596; got 1478385245.323438177
[ ... snip ... ]
% gomtree -f bundle1.mtree -p bundle2/rootfs
% echo $?
1

Note that I'm probably going to implement my own version of this unpacking functionality just so we can have more than one implementation of it, and then we can cross-verify bugs like this.

vbatts commented 7 years ago

I'd say add a unit test for this, but also, who wants to own this?

cyphar commented 7 years ago

Since umoci's oci/layer library fixes this, this will be fixed when oci/layer moves here. And umoci already has tests to deal with this case.

cyphar commented 4 years ago

This project is no longer actively maintained. However, umoci is a much more full-featured tool for manipulating OCI images, and is now an OCI project as a reference implementation of the OCI image-spec. I would strongly suggest people move to using umoci.