Commit 07d690f
targz: a compressed archive settles by giving back a whole block
CI found this, not the migration: three jobs went red on a change that
had passed a targeted local run, and one of the three was a latent fault
in compression rather than anything Go 1.27 did.
A 256 KiB archive at compression best would not settle. Traced: the
filler came down five or six bytes a round while the file sat at 262147
and 262148, wobbling by one. The filler is a tar entry and a tar entry is
padded to a whole 512 byte block, so handing back fewer than 512 bytes
changes WHICH bytes the archive carries and not HOW MANY - what comes out
of gzip then moves by a byte either way. The walk assumed a slope of one
and was stepping across a staircase.
That was true from the day compression landed. Go 1.27 only moved which
sizes sit on a step edge, which is why it looked like the compiler broke
it. So it gives back a whole block on an overshoot now: that lands under
the target, and the gzip extra field closes the rest exactly, because the
field adds precisely what it is given. Two rounds instead of never.
Checked over 90 consecutive sizes in four bands at all three levels.
The other two were mine and both were the guards being right.
sync.OnceValues in framing.go was new concurrency, which this project
asks to be declared. Declaring it would have been the wrong answer: the
registry works out this format's minimum during init, which asks for the
framing anyway, so nothing was ever lazy about it. A package level
variable is initialised once, before any goroutine exists, and needs no
lock. The guard found real over-engineering rather than a missing entry.
And a semicolon in a comment, which rule 13 does not take.
Adds tools/probes/targzsettle, which is how the staircase was seen, and a
mutation for the block step.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent f77d1fc commit 07d690f
2 files changed
Lines changed: 42 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
131 | 157 | | |
132 | 158 | | |
133 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
| 52 | + | |
54 | 53 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
0 commit comments