Commit 5a37265
fix: add ~/.local/bin to sandbox PATH for rootless copilot installs (#6407)
* fix: add ~/.local/bin to sbx PATH for rootless copilot installs
The sbx microVM runs `bash -lc` with the injected PATH from
buildCoreEnvironment() and, unlike the compose runtimes, never runs
entrypoint.sh (which already prepends $HOME/.local/bin). As a result a
copilot binary installed rootless to ~/.local/bin (via
install_copilot_cli.sh --rootless on ARC/DinD runners) was mounted into
the VM but not resolvable by name.
Prepend ${HOME}/.local/bin to the core PATH so all three runtimes
(Docker, gVisor, sbx) can resolve rootless-installed binaries. Harmless
for the compose runtimes, which rebuild PATH in entrypoint.sh anyway.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f534fc19-5261-4351-b4c7-78e205dc07a9
* fix: make rootless copilot resolution robust in sbx
Address review feedback on the sbx PATH approach:
1. Login shell resets PATH: execInSandbox runs `bash -lc`, and Debian/
Ubuntu /etc/profile unconditionally resets PATH, discarding anything
injected via `--env PATH=...`. Revert the ineffective core PATH change
and instead prepend the export inside the command string
(withLocalBinOnPath), which runs after login initialization and cannot
be clobbered by the profile.
2. Sudo home mismatch: createSandbox mounted home tool dirs from
process.env.HOME while buildCoreEnvironment injects HOME from
getRealUserHome() (honors SUDO_USER). Under sudo these diverge
(e.g. /root vs /home/alice), so .local was mounted where the guest
$HOME never points. Resolve the mount home via getRealUserHome() too.
The injected command uses $HOME at runtime, which equals the injected
HOME, so it targets the same tree that is now mounted. Tests cover the
actual sbx invocation path (execInSandbox arg wrapping) and the helper.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f534fc19-5261-4351-b4c7-78e205dc07a9
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 42165d7 commit 5a37265
2 files changed
Lines changed: 60 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
550 | 569 | | |
551 | 570 | | |
552 | 571 | | |
| |||
557 | 576 | | |
558 | 577 | | |
559 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
560 | 598 | | |
561 | 599 | | |
562 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
274 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
275 | 281 | | |
276 | 282 | | |
277 | 283 | | |
| |||
340 | 346 | | |
341 | 347 | | |
342 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
343 | 363 | | |
344 | 364 | | |
345 | 365 | | |
| |||
364 | 384 | | |
365 | 385 | | |
366 | 386 | | |
367 | | - | |
| 387 | + | |
368 | 388 | | |
369 | 389 | | |
370 | 390 | | |
| |||
0 commit comments