Commit 9ca1b80
committed
Fix Footer to make it compatible with RFC1952
This commit reflects the recent change on eStargz's footer format for making it
compatible with RFC1952[0].
Since this commit the footer is the following 51 bytes:
```
10 bytes gzip header
2 bytes XLEN (length of Extra field) = 26 (4 bytes header + 16 hex digits + len("STARGZ"))
2 bytes Extra: SI1 = 'S', SI2 = 'G'
2 bytes Extra: LEN = 22 (16 hex digits + len("STARGZ"))
22 bytes Extra: subfield = fmt.Sprintf("%016xSTARGZ", offsetOfTOC)
5 bytes flate header
8 bytes gzip footer
(End of the eStargz blob)
```
According to RFC1952, Extra field is defined as the following (quoted from [1]):
```
If the FLG.FEXTRA bit is set, an "extra field" is present in
the header, with total length XLEN bytes. It consists of a
series of subfields, each of the form:
+---+---+---+---+==================================+
|SI1|SI2| LEN |... LEN bytes of subfield data ...|
+---+---+---+---+==================================+
SI1 and SI2 provide a subfield ID, typically two ASCII letters
with some mnemonic value. Jean-Loup Gailly
<[email protected]> is maintaining a registry of subfield
IDs; please send him any subfield ID you wish to use. Subfield
IDs with SI2 = 0 are reserved for future use.
```
This commit adds SI1, SI2 and LEN fields to Extra field, which are lacked in the
stargz. As SI1 and SI2, we use (SI1, SI2) = ('S', 'G') for eStargz footer.
(P.S. ('A', 'P') is used by "Apollo file type information"[1] and ('R', 'A') is
used by dictzip[2])
Notes:
- This commit forks stargz lib for applying this change.
- This change makes eStargz incompatible with stargz (but still compatible with
tar.gz). Images provided by this commit's `ctr-remote` cannot be lazily pulled
by the stargz snapshotter before this commit. `--stargz-only` option is also
deprecated since this commit. Users should use `--no-optimize` option instead.
- As a fallback behaviour, the legacy footer is still supported by Stargz
Snapshotter plugin (i.e. it can lazily pull eStargz images older than this
commit).
Some minor changes for making linter happy are also included in this patch.
[0] https://tools.ietf.org/html/rfc1952
[1] https://tools.ietf.org/html/rfc1952#section-2.3.1.1
[2] https://linux.die.net/man/1/dictzip
Signed-off-by: Kohei Tokunaga <[email protected]>1 parent b1920d3 commit 9ca1b80
File tree
20 files changed
+1012
-295
lines changed- cmd/ctr-remote/commands
- estargz
- stargz
- fs
- reader
- script
- demo
- integration
- containerd
- vendor
- github.com/google/crfs
20 files changed
+1012
-295
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | | - | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 80 | | |
85 | 81 | | |
86 | 82 | | |
| |||
384 | 380 | | |
385 | 381 | | |
386 | 382 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
| 383 | + | |
408 | 384 | | |
409 | 385 | | |
410 | 386 | | |
| |||
703 | 679 | | |
704 | 680 | | |
705 | 681 | | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | 682 | | |
728 | 683 | | |
729 | 684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
371 | | - | |
| 370 | + | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | 26 | | |
28 | | - | |
| 27 | + | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 35 | + | |
41 | 36 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 37 | + | |
56 | 38 | | |
57 | 39 | | |
58 | 40 | | |
59 | | - | |
60 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
61 | 44 | | |
62 | 45 | | |
63 | 46 | | |
| |||
87 | 70 | | |
88 | 71 | | |
89 | 72 | | |
90 | | - | |
| 73 | + | |
91 | 74 | | |
92 | 75 | | |
93 | 76 | | |
| |||
128 | 111 | | |
129 | 112 | | |
130 | 113 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 114 | | |
143 | 115 | | |
144 | 116 | | |
145 | | - | |
| 117 | + | |
146 | 118 | | |
147 | 119 | | |
148 | 120 | | |
| |||
159 | 131 | | |
160 | 132 | | |
161 | 133 | | |
162 | | - | |
163 | 134 | | |
164 | 135 | | |
165 | 136 | | |
| |||
0 commit comments