image-tools icon indicating copy to clipboard operation
image-tools copied to clipboard

unpacking tools don't preserve mtime

Open cyphar opened this issue 9 years ago • 3 comments

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.

cyphar avatar Nov 05 '16 22:11 cyphar

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

vbatts avatar Mar 09 '17 16:03 vbatts

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 avatar Mar 09 '17 22:03 cyphar

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.

cyphar avatar Jun 22 '20 04:06 cyphar