tarsum: include xattr headers in to the checksum

this is to enhance the tarsum algorithm, but _MUST_ be done in lock step
with the same for docker-registry. (PR will be cited)

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
Vincent Batts 2014-05-21 17:13:53 -04:00
parent ed3d01687d
commit 3417eb9f00
4 changed files with 18 additions and 0 deletions

View file

@ -95,6 +95,18 @@ func (ts *tarSum) encodeHeader(h *tar.Header) error {
return err
}
}
// include the additional pax headers, from an ordered list
var keys []string
for k := range h.Xattrs {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
if _, err := ts.h.Write([]byte(k + h.Xattrs[k])); err != nil {
return err
}
}
return nil
}