opencontainers / image-tools

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

Fix descriptor matching logic #210

Open rafaelgieschke opened 5 years ago

rafaelgieschke commented 5 years ago

This fixes commit dab5ba5a642250dd8c2ddf954f9ffe60837a2e7b.

The for i := 0; i < len(descs); i++ loops inside findDescriptor skip one entry of descs at each non-match because the array length is reduced by 1 but the index i is not reduced:

skopeo copy docker://ubuntu oci:dir:a
skopeo copy docker://ubuntu oci:dir:b
skopeo copy docker://ubuntu oci:dir:c
./oci-image-tool unpack --ref name=c dir dir2

index.json: descriptor retrieved by refs [name=c] is not unique