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)
| ... | ... |
@@ -95,6 +95,18 @@ func (ts *tarSum) encodeHeader(h *tar.Header) error {
|
| 95 | 95 |
return err |
| 96 | 96 |
} |
| 97 | 97 |
} |
| 98 |
+ |
|
| 99 |
+ // include the additional pax headers, from an ordered list |
|
| 100 |
+ var keys []string |
|
| 101 |
+ for k := range h.Xattrs {
|
|
| 102 |
+ keys = append(keys, k) |
|
| 103 |
+ } |
|
| 104 |
+ sort.Strings(keys) |
|
| 105 |
+ for _, k := range keys {
|
|
| 106 |
+ if _, err := ts.h.Write([]byte(k + h.Xattrs[k])); err != nil {
|
|
| 107 |
+ return err |
|
| 108 |
+ } |
|
| 109 |
+ } |
|
| 98 | 110 |
return nil |
| 99 | 111 |
} |
| 100 | 112 |
|
| ... | ... |
@@ -38,6 +38,11 @@ var testLayers = []testLayer{
|
| 38 | 38 |
gzip: true, |
| 39 | 39 |
tarsum: "tarsum+sha256:e58fcf7418d4390dec8e8fb69d88c06ec07039d651fedd3aa72af9972e7d046b"}, |
| 40 | 40 |
{
|
| 41 |
+ filename: "testdata/xattr/layer.tar", |
|
| 42 |
+ jsonfile: "testdata/xattr/json", |
|
| 43 |
+ // without xattr support, this layer produces "tarsum+sha256:e86f81a4d552f13039b1396ed03ca968ea9717581f9577ef1876ea6ff9b38c98" |
|
| 44 |
+ tarsum: "tarsum+sha256:eadcd9c55164e2a942ea67f781abbf645ee55d36e173c34de8a36d4d69d3021c"}, |
|
| 45 |
+ {
|
|
| 41 | 46 |
filename: "testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar", |
| 42 | 47 |
jsonfile: "testdata/511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/json", |
| 43 | 48 |
tarsum: "tarsum+sha256:ac672ee85da9ab7f9667ae3c32841d3e42f33cc52c273c23341dabba1c8b0c8b"}, |
| 44 | 49 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1 @@ |
| 0 |
+{"id":"4439c3c7f847954100b42b267e7e5529cac1d6934db082f65795c5ca2e594d93","parent":"73b164f4437db87e96e90083c73a6592f549646ae2ec00ed33c6b9b49a5c4470","created":"2014-05-16T17:19:44.091534414Z","container":"5f92fb06cc58f357f0cde41394e2bbbb664e663974b2ac1693ab07b7a306749b","container_config":{"Hostname":"9565c6517a0e","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","setcap 'cap_setgid,cap_setuid+ep' ./file \u0026\u0026 getcap ./file"],"Image":"73b164f4437db87e96e90083c73a6592f549646ae2ec00ed33c6b9b49a5c4470","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":[]},"docker_version":"0.11.1-dev","config":{"Hostname":"9565c6517a0e","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"Cpuset":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":null,"Image":"73b164f4437db87e96e90083c73a6592f549646ae2ec00ed33c6b9b49a5c4470","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":[]},"architecture":"amd64","os":"linux","Size":0}
|
|
| 0 | 1 |
\ No newline at end of file |