Open kkujawinski opened 7 years ago
Cache checksum is calculated based on first file occurance, while in building last occurance is used.
ping @tonistiigi @simonferquel PTAL
I'm not sure we should support duplicate files, we do not support files like this for push/pull operations for example. It is fixed in https://github.com/moby/buildkit/pull/90 with a range of other similar issues. The old tarsum code does preserve any uniqueness for the paths, even if you sort the items for this specific case you will have the same problem when copying a directory containing duplicates.
Unfortunately the tar cli tools don't support file replacement, so when you update files in an archive they get appended to the end (and the consequence is that the archive will have duplicates). I don't like this either but there's no nice way around this, so Docker cli should support this sort of use (it's natural with tar, like it or not).
Docker build calculates same cache checksums for different tar contexts.
Test case
Files structure:
Preparing ctx1.tar, building and running:
The same for ctx2.tar
Second build is calculating same cache checksum, despite different tars content.
I am attaching test case, which:
You can see that:
Expected:
docker info:
docker version:
tar_duplicates.zip