Repository navigation
Commit 891a0bb
committed
fix(updater): do not leak the export container, write the fstab into the target
Four things, each with its test:
A failed "docker export" left the container behind. Every failed attempt made
one more, and a device that cannot reach the registry for a week makes seven.
It is removed before raise 107 now. A run that is killed still leaks one -
nothing short of a reaper covers that.
write_fstab wrote /etc/fstab - the updater container's own - and copied it into
the new rootfs afterwards. It describes the target's layout, so a tool that
read it there would take the target's disk for its own; nothing does. Checked:
no script in the four repos reads an fstab, no "mount -a" anywhere, every mount
names its device and options, and the grub backend writes grub.cfg by hand with
root=LABEL=system rootflags=subvol= from CONTAINER_ROOTFS. grub-install itself
resolves devices through grub-probe and the kernel's mount table, not fstab -
that is upstream behaviour, not measured here, and the first x86 build says so
either way, loudly (raise 122/123).
check_environment refuses to run when TARGET_ROOT or TARGET_BOOT is not a
mountpoint or no image was named. prepare_slot deletes ${TARGET_BOOT}/${SLOT}_*
and creates a subvolume under TARGET_ROOT; with the variables empty that is
rm -f /A_* and a subvolume in /. docker_environment.sh has always mounted both
and raises if it cannot, so this is insurance, not a live bug - but it is the
kind of insurance that costs three lines.
Smaller: is_local_build() replaces the inverted condition in pull_image,
image_digest takes the digest the caller already has instead of asking docker a
second time, and prepare_slot skips "docker image rm" when the old slot had no
/etc/image rather than calling it with an empty argument and swallowing the
error.
The suite is at 53 cases. Removing the container cleanup, either mountpoint
check, the fstab target or the -n guard each turns it red - checked. Not run in
a real build.
Signed-off-by: Simon Walz <contact@simonwalz.de>1 parent 72c1628 commit 891a0bb
2 files changed
Lines changed: 114 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
| |||
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
171 | | - | |
172 | | - | |
| 183 | + | |
| 184 | + | |
173 | 185 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 186 | + | |
178 | 187 | | |
179 | 188 | | |
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
184 | 193 | | |
185 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
186 | 197 | | |
187 | 198 | | |
188 | 199 | | |
| |||
191 | 202 | | |
192 | 203 | | |
193 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
194 | 211 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
199 | 216 | | |
200 | 217 | | |
201 | 218 | | |
| |||
205 | 222 | | |
206 | 223 | | |
207 | 224 | | |
| 225 | + | |
208 | 226 | | |
209 | 227 | | |
210 | 228 | | |
| |||
213 | 231 | | |
214 | 232 | | |
215 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
216 | 238 | | |
217 | | - | |
| 239 | + | |
218 | 240 | | |
219 | | - | |
| 241 | + | |
220 | 242 | | |
221 | 243 | | |
222 | 244 | | |
| |||
226 | 248 | | |
227 | 249 | | |
228 | 250 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 251 | | |
235 | 252 | | |
236 | 253 | | |
| |||
261 | 278 | | |
262 | 279 | | |
263 | 280 | | |
| 281 | + | |
| 282 | + | |
264 | 283 | | |
265 | 284 | | |
266 | 285 | | |
| |||
295 | 314 | | |
296 | 315 | | |
297 | 316 | | |
298 | | - | |
| 317 | + | |
299 | 318 | | |
300 | 319 | | |
301 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
| |||
140 | 151 | | |
141 | 152 | | |
142 | 153 | | |
143 | | - | |
144 | | - | |
| 154 | + | |
145 | 155 | | |
146 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
147 | 191 | | |
148 | 192 | | |
149 | 193 | | |
150 | 194 | | |
151 | 195 | | |
152 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
153 | 206 | | |
154 | 207 | | |
155 | 208 | | |
| |||
183 | 236 | | |
184 | 237 | | |
185 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
186 | 250 | | |
187 | 251 | | |
188 | 252 | | |
| |||
192 | 256 | | |
193 | 257 | | |
194 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
195 | 266 | | |
196 | 267 | | |
197 | 268 | | |
198 | 269 | | |
| 270 | + | |
| 271 | + | |
199 | 272 | | |
200 | 273 | | |
201 | 274 | | |
| |||
0 commit comments