Commit 0d33212
committed
fix:
Root cause: `cmd_self_config` called the full `load_or_init`, whose step 7
(xlings sandbox bootstrap — `xlings self init`, ensure_patchelf,
ensure_ninja) hits the network using the *current* `.xlings.json` mirror.
On a fresh MCPP_HOME that's the seeded default `"CN"`, so the act of
running `mcpp self config --mirror GLOBAL` would download from CN before
having a chance to switch — the very chicken-and-egg the command is
supposed to break.
Fix:
- `config::load_or_init` grows a `skip_xlings_bootstrap` parameter
(default false, all existing callers unchanged). When true, steps 1-6
still run (dirs / config.toml / .xlings.json seed / xlings binary
acquisition — all local) but step 7 (the network roundtrip) is skipped.
- New `xlings::set_mirror_in_xlings_json(path, mirror)`: in-place text
edit of just the `"mirror"` field, preserving every other key (no
subprocess, no network, safe pre-bootstrap).
- `cmd_self_config` rewritten:
* `--mirror X` path: `load_or_init(skip_xlings_bootstrap=true)` then
`set_mirror_in_xlings_json`. Pure local file ops, completes in ms.
* no-arg show path: same `skip_xlings_bootstrap=true`, since
`xlings config` only reads `.xlings.json` (doesn't need patchelf
or ninja).
The next mcpp invocation that genuinely needs bootstrap (build / run /
toolchain install) runs the full bootstrap with the just-saved mirror
in effect.
TODO comments added at both `seed_xlings_json` and `cmd_self_config`
about the long-term direction of the default mirror — either flip to
`GLOBAL` (with docs covering the CN opt-in switch) or auto-detect
(env hint + a quick HEAD probe with a tight timeout, pinning the
winning value).
Test: tests/e2e/46_self_config_mirror_no_bootstrap.sh — fresh MCPP_HOME,
runs `mcpp self config --mirror GLOBAL` under a 10s timeout, asserts
.xlings.json picks up GLOBAL and that xim-x-patchelf / xim-x-ninja
were NOT installed by this command (proving no network bootstrap fired).
Round-trips back to CN as a second pure-local edit.
Existing test 38_self_config_mirror.sh still passes: it always called
`mcpp self env` first (which uses the original full-bootstrap path), so
the "default mirror is CN" invariant is preserved.mcpp self config --mirror X hangs on fresh MCPP_HOME1 parent 73ffe30 commit 0d33212
4 files changed
Lines changed: 199 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4355 | 4355 | | |
4356 | 4356 | | |
4357 | 4357 | | |
4358 | | - | |
4359 | | - | |
4360 | | - | |
4361 | | - | |
4362 | | - | |
4363 | | - | |
4364 | | - | |
4365 | 4358 | | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
4369 | | - | |
4370 | 4359 | | |
4371 | | - | |
4372 | | - | |
4373 | | - | |
4374 | | - | |
4375 | | - | |
| 4360 | + | |
| 4361 | + | |
| 4362 | + | |
| 4363 | + | |
| 4364 | + | |
| 4365 | + | |
| 4366 | + | |
| 4367 | + | |
| 4368 | + | |
| 4369 | + | |
| 4370 | + | |
| 4371 | + | |
| 4372 | + | |
| 4373 | + | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
| 4394 | + | |
4376 | 4395 | | |
4377 | 4396 | | |
4378 | | - | |
4379 | | - | |
4380 | | - | |
4381 | | - | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
| 4400 | + | |
| 4401 | + | |
| 4402 | + | |
| 4403 | + | |
| 4404 | + | |
| 4405 | + | |
4382 | 4406 | | |
4383 | | - | |
4384 | | - | |
| 4407 | + | |
| 4408 | + | |
| 4409 | + | |
4385 | 4410 | | |
4386 | 4411 | | |
4387 | 4412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
189 | 196 | | |
190 | 197 | | |
191 | | - | |
| 198 | + | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| |||
385 | 393 | | |
386 | 394 | | |
387 | 395 | | |
388 | | - | |
| 396 | + | |
| 397 | + | |
389 | 398 | | |
390 | 399 | | |
391 | 400 | | |
| |||
538 | 547 | | |
539 | 548 | | |
540 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
541 | 557 | | |
542 | 558 | | |
543 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
200 | 214 | | |
201 | 215 | | |
202 | 216 | | |
203 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
204 | 228 | | |
205 | 229 | | |
206 | 230 | | |
| |||
790 | 814 | | |
791 | 815 | | |
792 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
793 | 854 | | |
794 | 855 | | |
795 | 856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
0 commit comments