diff --git a/CHANGELOG.md b/CHANGELOG.md index 96fecf19..652a38c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -235,9 +235,10 @@ These changes are on `main` and go out in the next release. - `devvm agent save` no longer refuses a VM whose `~/.config/opencode` holds a `bun.lock` or another file the store doesn't keep, which stays in the VM ([details](https://next.devvm.dev/docs/releases/0.2.0/#opencodes-lock-files-in-a-save)). -
Security hardening: a VM's history export can no longer have opencode run commands unasked in the VM you import it into +
Security hardening: a VM can no longer be started unconfined past devvm's checks, and its history export can no longer have opencode run commands unasked in the VM you import it into - `devvm history export` and `devvm history import` leave out opencode's automations, approvals, allow rules, resumable turns, project commands, git repositories and approved plugins, so make again any automation you want in the new VM ([details](https://next.devvm.dev/docs/releases/0.2.0/#opencodes-automations-and-permissions-in-history)). +- devvm's shell or command in a VM that just shut itself down now fails, where Lima asked whether to start the VM, yes by default, and started it unconfined and past devvm's checks ([details](https://next.devvm.dev/docs/releases/0.2.0/#a-stopped-vms-shell)).
Internal changes diff --git a/docs/content/docs/internals/lima.md b/docs/content/docs/internals/lima.md index 1f55c92d..8b6d15af 100644 --- a/docs/content/docs/internals/lima.md +++ b/docs/content/docs/internals/lima.md @@ -40,6 +40,10 @@ devvm leaves Lima's `mountInotify` off, so file watchers in the VM see only the devvm opens a VM's shell, and runs an agent's login, with `limactl shell`, which asks ssh to send your terminal's `COLORTERM`. That request never reaches the VM, because the session goes over the ssh connection that Lima shares between all of a VM's sessions, which was opened without it ([lima-vm/lima#2208](https://github.com/lima-vm/lima/issues/2208)). Closing that connection would end every session and the VM's SSH agent relay with it, so devvm sets `COLORTERM` in the command it runs in the VM instead. It passes only `truecolor` and `24bit`, the two values that say a terminal shows 24-bit color, and it quotes them for the VM's shell. Quoting alone would make any value safe, but devvm sends a VM only values it knows. It passes nothing for any other value or when `COLORTERM` isn't set, and then the shell starts as `limactl shell` starts it by itself. +## A stopped VM's shell + +Every `limactl shell` that devvm runs says `--start=false`. In a terminal, `limactl shell` of a stopped VM asks whether to start it, and the question's default is yes, but that start skips every check of devvm's own start. A VM on a confined tier would run unconfined, without its proxy, and any VM would mount whatever is at the project folder's path, a folder that replaced it included, and Lima would make the folder again if it's gone. So a VM that stops while devvm works with it, such as one whose guest shut itself down, makes devvm's shell or command fail, and devvm's next launch starts it with every check. + ## Confinement A VM on a confined tier, internet, allowlist or none, reaches nothing but its proxy on the host, which applies its tier's rules, and even root in the VM can't get around that. Direct connections, DNS, UDP and connections to the host's own services fail at once, while forwarded ports, mounts and ssh keep working. [Processes](processes.md) has what the hostagent and the QEMU wrapper hold, write and wait for ([Lima's hostagent](processes.md#limas-hostagent), [the QEMU wrapper](processes.md#the-qemu-wrapper-and-its-keeper)). diff --git a/docs/content/docs/releases/0.2.0.md b/docs/content/docs/releases/0.2.0.md index 818a7cf1..65dfc2a5 100644 --- a/docs/content/docs/releases/0.2.0.md +++ b/docs/content/docs/releases/0.2.0.md @@ -430,3 +430,7 @@ The copy in an export, and the copy that an import makes of a database in any ex - no project commands The copy drops every view and refuses a table with a generated column, which could hide rows from these steps, and its own check counts what's left and leaves the database out unless nothing is. An export also leaves out opencode's `snapshot`, `repos` and `worktree` folders, and an import never writes them, so an export doesn't hold opencode's worktrees. The worktrees' commits are in your project's own repository, and `devvm rm`, which deletes their folders with the VM, now checks them for uncommitted changes first ([opencode's worktrees before a VM goes](#opencodes-worktrees-before-a-vm-goes)). An export also leaves out the project plugins you approved in opencode's native client, which doesn't ship yet: `plugin-approvals.json` and the `plugin-staged` folder in `~/.local/state/opencode`. That client runs the staged copies without checking their hash again, so without this a hostile VM's export could approve a plugin for the VM you import it into. In the new VM, make again any automation you want, and opencode asks again before the requests you had always allowed. A VM made again keeps its own, because its home folder's copy isn't an export ([what an export holds](../internals/agents.md#history-exports)). + +### A stopped VM's shell + +In a terminal, `limactl shell` of a stopped VM asks whether to start it, yes by default. When a VM shut itself down as devvm opened its shell or ran a command in it, you could get that question, and a yes, or just Enter, started the VM as Lima does: unconfined and without its proxy, mounting a folder that replaced the project folder, or making the project folder again if it was gone. devvm's own start refuses each of these. Every `limactl shell` that devvm runs now says not to start the VM, so the shell or command fails, and devvm's next launch starts the VM with every check ([a stopped VM's shell](../internals/lima.md#a-stopped-vms-shell)). diff --git a/internal/backend/lima/build_test.go b/internal/backend/lima/build_test.go index da251fd3..b02eaf4e 100644 --- a/internal/backend/lima/build_test.go +++ b/internal/backend/lima/build_test.go @@ -124,8 +124,8 @@ func TestBuildImageBase(t *testing.T) { " --cpus=4 --memory=8 --disk=100 -", "limactl edit --tty=false " + inst + " --set .ssh.localPort=", "sandbox-exec -f " + l.Dirs.VM(inst).Profile() + " ", - "limactl shell " + inst + " bash -s", - "limactl shell --workdir / " + inst + " sync", + "limactl shell --start=false " + inst + " bash -s", + "limactl shell --start=false --workdir / " + inst + " sync", "limactl stop " + inst, }) for _, c := range f.calls { @@ -171,12 +171,12 @@ func TestBuildImageLayer(t *testing.T) { "limactl clone --tty=false --mount-none devvm-img-" + baseKey + " " + inst, "limactl edit --tty=false " + inst + " --set .ssh.localPort=", "limactl start --tty=false " + inst, - "limactl shell --workdir / " + inst + " sudo sh -s", - "limactl shell " + inst + " bash -s", - "limactl shell " + inst + " bash -s -- a b c", - "limactl shell --workdir / " + inst + " sudo bash -s", - "limactl shell --workdir / " + inst + " sudo sh -s", - "limactl shell --workdir / " + inst + " sync", + "limactl shell --start=false --workdir / " + inst + " sudo sh -s", + "limactl shell --start=false " + inst + " bash -s", + "limactl shell --start=false " + inst + " bash -s -- a b c", + "limactl shell --start=false --workdir / " + inst + " sudo bash -s", + "limactl shell --start=false --workdir / " + inst + " sudo sh -s", + "limactl shell --start=false --workdir / " + inst + " sync", "limactl stop " + inst, }) // Each step as it is, after the CAs' variables; the CAs' own scripts @@ -297,12 +297,12 @@ func TestBuildImageHostProxy(t *testing.T) { scripts = append(scripts, c.line()+"\n"+c.stdin) } } - if len(scripts) != 3 || !strings.HasPrefix(scripts[1], "limactl shell "+inst+" bash -s\nexport HTTPS_PROXY='http://devvm:") || + if len(scripts) != 3 || !strings.HasPrefix(scripts[1], "limactl shell --start=false "+inst+" bash -s\nexport HTTPS_PROXY='http://devvm:") || !strings.Contains(scripts[1], "@192.168.5.2:40000' https_proxy='http://devvm:") || !strings.HasSuffix(scripts[1], "@192.168.5.2:40000' NO_PROXY='.corp' no_proxy='.corp'; #!/bin/bash\necho foo\n") { t.Errorf("scripts:\n%s", strings.Join(scripts, "\n--\n")) } - if want := "limactl shell --workdir / " + inst + " sudo sh -s\nprintf '%s\\n' '" + sudoKeepProxy + + if want := "limactl shell --start=false --workdir / " + inst + " sudo sh -s\nprintf '%s\\n' '" + sudoKeepProxy + "' > /etc/sudoers.d/devvm-build-proxy && chmod 440 /etc/sudoers.d/devvm-build-proxy\n"; len(scripts) == 3 && scripts[0] != want { t.Errorf("sudo: %s", scripts[0]) } @@ -405,7 +405,7 @@ func TestBuildImageHostProxyRefused(t *testing.T) { func TestBuildImageScriptFails(t *testing.T) { l, f := buildLima(t, "darwin", "") const inst = vmname.ImagePrefix + baseKey - f.fail = []string{"limactl shell " + inst + " bash -s"} + f.fail = []string{"limactl shell --start=false " + inst + " bash -s"} _, err := l.BuildImage(t.Context(), baseSpec(t, l)) e, ok := errors.AsType[*backend.LoggedError](err) if !ok || e.Msg.ID() != "script_failed" { diff --git a/internal/backend/lima/lima_test.go b/internal/backend/lima/lima_test.go index bca60fa4..761a1bd0 100644 --- a/internal/backend/lima/lima_test.go +++ b/internal/backend/lima/lima_test.go @@ -1107,7 +1107,7 @@ func TestExecAndShell(t *testing.T) { if err := l.Exec(t.Context(), "v", []string{"echo", "it's $HOME"}, backend.ExecOpts{Dir: "/my dir"}); err != nil { t.Fatal(err) } - want := []string{"limactl", "shell", "--workdir", "/", "v", "sh", "-c", `cd '/my dir' && exec 'echo' 'it'\''s $HOME'`} + want := []string{"limactl", "shell", "--start=false", "--workdir", "/", "v", "sh", "-c", `cd '/my dir' && exec 'echo' 'it'\''s $HOME'`} if got := f.calls[0].argv; !slices.Equal(got, want) { t.Errorf("Exec ran %q, want %q", got, want) } @@ -1130,7 +1130,7 @@ func TestExecAndShell(t *testing.T) { if err != nil { t.Fatal(err) } - if !filepath.IsAbs(c.Path) || !slices.Equal(c.Args[1:], []string{"shell", "--workdir", "/p", "v"}) || + if !filepath.IsAbs(c.Path) || !slices.Equal(c.Args[1:], []string{"shell", "--start=false", "--workdir", "/p", "v"}) || c.Dir != l.Dirs.Data || !slices.Contains(c.Env, "LIMA_HOME="+l.Dirs.Lima) { t.Errorf("Shell: %+v", c) } @@ -1145,6 +1145,34 @@ func TestExecAndShell(t *testing.T) { } } +// Every limactl shell devvm runs, Exec's, Shell's and the builds' alike, +// says --start=false, so limactl never asks in a terminal to start a +// stopped VM itself (its default is yes), which would start it past +// devvm's checks: unconfined, and mounting a project folder that's gone +// or replaced. Other commands are as given. +func TestShellNeverStarts(t *testing.T) { + l, f, _ := testLima(t, "darwin") + if err := l.Exec(t.Context(), "v", []string{"true"}, backend.ExecOpts{}); err != nil { + t.Fatal(err) + } + c, err := l.Shell(t.Context(), "v", backend.ShellOpts{Dir: "/p"}) + if err != nil { + t.Fatal(err) + } + for name, args := range map[string][]string{ + "Exec": f.calls[0].argv[1:], + "Shell": c.Args[1:], + "limactl": l.limactl(t.Context(), "shell", "--workdir", "/", "v", "sync").Args[1:], + } { + if len(args) < 2 || args[0] != "shell" || args[1] != "--start=false" { + t.Errorf("%s ran limactl %q, want shell --start=false first", name, args) + } + } + if got := l.limactl(t.Context(), "stop", "v").Args[1:]; !slices.Equal(got, []string{"stop", "v"}) { + t.Errorf("stop ran limactl %q", got) + } +} + // Exec and Shell set the COLORTERM they're given in the guest's shell, // quoted, before the command or the login shell, which limactl shell's // own SendEnv doesn't (lima-vm/lima#2208); with none, they're as they @@ -1164,7 +1192,7 @@ func TestExecAndShellColorTerm(t *testing.T) { if err := l.Exec(t.Context(), "v", []string{"tput", "colors"}, backend.ExecOpts{Dir: "/p", ColorTerm: c.colorTerm}); err != nil { t.Fatal(err) } - want := []string{"limactl", "shell", "--workdir", "/", "v", "sh", "-c", c.exec} + want := []string{"limactl", "shell", "--start=false", "--workdir", "/", "v", "sh", "-c", c.exec} if got := f.calls[0].argv; !slices.Equal(got, want) { t.Errorf("Exec with COLORTERM %q ran %q, want %q", c.colorTerm, got, want) } @@ -1172,7 +1200,7 @@ func TestExecAndShellColorTerm(t *testing.T) { if err != nil { t.Fatal(err) } - if want := append([]string{"shell", "--workdir", "/p", "v"}, c.shell...); !slices.Equal(cmd.Args[1:], want) { + if want := append([]string{"shell", "--start=false", "--workdir", "/p", "v"}, c.shell...); !slices.Equal(cmd.Args[1:], want) { t.Errorf("Shell with COLORTERM %q ran %q, want %q", c.colorTerm, cmd.Args[1:], want) } } diff --git a/internal/backend/lima/limactl.go b/internal/backend/lima/limactl.go index bec62064..da357553 100644 --- a/internal/backend/lima/limactl.go +++ b/internal/backend/lima/limactl.go @@ -59,8 +59,16 @@ func (logRunner) Attach(cmd *exec.Cmd) error { return cmd.Run() } // those lines on to devvm's run log, which keeps URL passwords out, and // Start takes them out of the hostagent's own log (redactLog). It carries // no SSH agent: a command that reaches a VM gets the VM's own (withAgent), -// never whichever devvm started with. +// never whichever devvm started with. A limactl shell gets --start=false: +// in a terminal, limactl shell of a stopped VM asks whether to start it, +// yes by default, and its start would skip every check of devvm's start, +// so a VM that stopped itself would run unconfined, without its proxy, +// mounting a project folder that's gone (which Lima makes again) or +// replaced. A stopped VM's shell fails instead. func (l *Lima) limactl(ctx context.Context, args ...string) *exec.Cmd { + if len(args) > 0 && args[0] == "shell" { + args = slices.Concat([]string{"shell", "--start=false"}, args[1:]) + } cmd := exec.CommandContext(ctx, "limactl", args...) //nolint:gosec // devvm's own arguments cmd.Env = setEnv(os.Environ(), append(backend.ClientProxyVars(), "SSH_AUTH_SOCK", "LIMA_HOME="+l.Dirs.Lima)...) cmd.Dir = l.Dirs.Data diff --git a/internal/backend/lima/packages_test.go b/internal/backend/lima/packages_test.go index 8688e957..d3a4fc5a 100644 --- a/internal/backend/lima/packages_test.go +++ b/internal/backend/lima/packages_test.go @@ -17,7 +17,7 @@ import ( func TestBuildImagePackages(t *testing.T) { l, f := buildLima(t, "darwin", "") inst := "devvm-img-" + baseKey - f.stdout = map[string]string{"limactl shell --workdir / " + inst + " sh -c cd '/' && exec 'sudo' 'sh' '-c' 'mkdir -p": "what came out"} + f.stdout = map[string]string{"limactl shell --start=false --workdir / " + inst + " sh -c cd '/' && exec 'sudo' 'sh' '-c' 'mkdir -p": "what came out"} var took string spec := baseSpec(t, l) spec.Packages = &backend.Packages{ @@ -72,7 +72,7 @@ func TestBuildImagePackagesFail(t *testing.T) { l, f := buildLima(t, "darwin", "") inst := "devvm-img-" + baseKey if c.fail != "" { - prefix := "limactl shell --workdir / " + inst + " sh -c cd '/' && exec 'sudo' " + prefix := "limactl shell --start=false --workdir / " + inst + " sh -c cd '/' && exec 'sudo' " if c.fail == "'rm' '-rf'" { f.fail = []string{prefix + c.fail} } else { @@ -114,12 +114,12 @@ func TestBuildImageNoBoot(t *testing.T) { func TestBuildImageSourcesUnreachable(t *testing.T) { l, f := buildLima(t, "darwin", "") inst := "devvm-img-" + baseKey - f.exit = map[string]int{"limactl shell " + inst + " bash -s": backend.ExitUnreachable} + f.exit = map[string]int{"limactl shell --start=false " + inst + " bash -s": backend.ExitUnreachable} _, err := l.BuildImage(t.Context(), baseSpec(t, l)) if e, ok := errors.AsType[*backend.LoggedError](err); !ok || e.Msg.Names() != "build_sources_unreachable script=base.sh vm="+inst { t.Errorf("got %v", err) } - f.exit = map[string]int{"limactl shell " + inst + " bash -s": 1} + f.exit = map[string]int{"limactl shell --start=false " + inst + " bash -s": 1} _, err = l.BuildImage(t.Context(), baseSpec(t, l)) if msg.IDOf(err) == "build_sources_unreachable" { t.Errorf("exit 1: %v", err) diff --git a/internal/backend/lima/remount_test.go b/internal/backend/lima/remount_test.go index 06b6fe81..12bdf217 100644 --- a/internal/backend/lima/remount_test.go +++ b/internal/backend/lima/remount_test.go @@ -10,7 +10,7 @@ import ( // checkOfP is the guest's check of the folder /p, as the fake runner // sees its command line. -const checkOfP = `limactl shell --workdir / v sh -c if mountpoint -q '/p'; then P='/p' ` + lastMount + +const checkOfP = `limactl shell --start=false --workdir / v sh -c if mountpoint -q '/p'; then P='/p' ` + lastMount + ` /proc/self/mountinfo; else echo devvm-not-mounted; fi` // mountinfoOfP is /p's line of mountinfo, a 9p share with the file diff --git a/internal/backend/lima/start_test.go b/internal/backend/lima/start_test.go index 8361faad..e17ca5f5 100644 --- a/internal/backend/lima/start_test.go +++ b/internal/backend/lima/start_test.go @@ -538,7 +538,7 @@ func TestStartSetsProjectCacheOnce(t *testing.T) { } // The folder as the guest has it after the remount: mounted with none. check := checkOfP - remount := `limactl shell --workdir / v sudo sh -c umount '/p' || exit 3; mount '/p' || { mount '/p'; mountpoint -q '/p' || exit 4; }` + remount := `limactl shell --start=false --workdir / v sudo sh -c umount '/p' || exit 3; mount '/p' || { mount '/p'; mountpoint -q '/p' || exit 4; }` f.stdout = map[string]string{check: mountinfoOfP("rw,access=client,msize=131072,trans=virtio") + "\n"} f.out["limactl list --json"] = vm("mmap") if err := os.MkdirAll(l.Dirs.LimaVM("v"), 0o700); err != nil { @@ -712,7 +712,7 @@ func TestStartRechecksProjectCache(t *testing.T) { if err := os.MkdirAll(l.Dirs.LimaVM("v"), 0o700); err != nil { t.Fatal(err) } - remount := `limactl shell --workdir / v sudo sh -c umount` + remount := `limactl shell --start=false --workdir / v sudo sh -c umount` w := backend.Want{Project: "/p", ProjectCache: backend.CacheNone, CheckCache: true} for _, tc := range []struct { name string diff --git a/internal/backend/lima/tools_test.go b/internal/backend/lima/tools_test.go index 642bc95a..6e807276 100644 --- a/internal/backend/lima/tools_test.go +++ b/internal/backend/lima/tools_test.go @@ -35,7 +35,7 @@ func TestBuildTools(t *testing.T) { `","mountPoint":"/mnt/devvm-tools","writable":true,"9p":{"cache":"none"}}] devvm-img-` + baseKey + " " + string(ToolsVM), "limactl edit --tty=false " + string(ToolsVM) + " --set .ssh.localPort=", "limactl start --tty=false " + string(ToolsVM), - "limactl shell --workdir / " + string(ToolsVM) + " bash -s -- node 24.21.0 node-24.21.0-0123456789ab.erofs", + "limactl shell --start=false --workdir / " + string(ToolsVM) + " bash -s -- node 24.21.0 node-24.21.0-0123456789ab.erofs", "limactl delete -f " + string(ToolsVM), }) } @@ -64,13 +64,13 @@ func TestBuildToolsTrust(t *testing.T) { // run's cleanup, so the run log ends with the script's output. func TestBuildToolsFails(t *testing.T) { l, f := buildLima(t, "darwin", "Stopped") - f.fail = []string{"limactl shell --workdir / " + string(ToolsVM) + " bash -s"} + f.fail = []string{"limactl shell --start=false --workdir / " + string(ToolsVM) + " bash -s"} err := l.BuildTools(t.Context(), toolsSpec(t, t.TempDir())) if e, ok := errors.AsType[*backend.LoggedError](err); !ok || e.Msg.ID() != "tools_build_failed" { t.Fatalf("BuildTools = %v", err) } lines := f.lines() - if last := lines[len(lines)-1]; !strings.HasPrefix(last, "limactl shell --workdir / "+string(ToolsVM)) { + if last := lines[len(lines)-1]; !strings.HasPrefix(last, "limactl shell --start=false --workdir / "+string(ToolsVM)) { t.Errorf("last call %q, want the script", last) } } diff --git a/testdata/script/build.txtar b/testdata/script/build.txtar index 4ce47afd..4c9983fb 100644 --- a/testdata/script/build.txtar +++ b/testdata/script/build.txtar @@ -25,8 +25,8 @@ cmp $STUB_DIR/create-template $DEVVM_REPO/assets/base.yaml ! exists $XDG_DATA_HOME/devvm/assets stdout '^limactl edit --tty=false devvm-img-[0-9a-f]{12} .*--set \.portForwards = \[\{"guestIP":"127\.0\.0\.1"' stdout '^limactl start --tty=false devvm-img-[0-9a-f]{12}$' -stdout '^limactl shell devvm-img-[0-9a-f]{12} bash -s$' -stdout '^limactl shell --workdir / devvm-img-[0-9a-f]{12} sync$' +stdout '^limactl shell --start=false devvm-img-[0-9a-f]{12} bash -s$' +stdout '^limactl shell --start=false --workdir / devvm-img-[0-9a-f]{12} sync$' stdout '^limactl stop devvm-img-[0-9a-f]{12}$' # Its ssh port is devvm's, on every host, given up once it has started. stdout '^limactl edit --tty=false devvm-img-[0-9a-f]{12} --set \.ssh\.localPort=[1-9][0-9]+ ' @@ -128,7 +128,7 @@ stderr '^devvm: tool_not_layer tool=node$' exec sh -c ': > "$STUB_DIR/shell-fails"' ! exec devvm build foo+bar stderr '^--- log_end file=.*\.log$' -stderr '^\+ limactl shell --workdir / devvm-img-[0-9a-f]{12} sudo bash -s -- lists$' +stderr '^\+ limactl shell --start=false --workdir / devvm-img-[0-9a-f]{12} sudo bash -s -- lists$' stderr '^devvm: script_failed script=apt\.sh vm=devvm-img-[0-9a-f]{12}$' ! stdout unfinished_image stub_calls diff --git a/testdata/script/clone.txtar b/testdata/script/clone.txtar index 4e2444b4..8922dc3c 100644 --- a/testdata/script/clone.txtar +++ b/testdata/script/clone.txtar @@ -61,7 +61,7 @@ stub_calls stdout '^limactl clone --tty=false devvm-img-[0-9a-f]{12} devvm-web-[0-9a-f]{14} --mount-none --set \.mounts = \[\{"location":"[^"]*/data/devvm/tools","mountPoint":"/mnt/devvm-tools","writable":false\}\] ' ! stdout 'git-receive-pack' ! stdout elsewhere -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' ! stdout chflags stub_reset exec devvm clone fetch diff --git a/testdata/script/clone_workspace.txtar b/testdata/script/clone_workspace.txtar index dee2d3f7..e72525c6 100644 --- a/testdata/script/clone_workspace.txtar +++ b/testdata/script/clone_workspace.txtar @@ -113,7 +113,7 @@ stub_reset exec devvm stdout '^==> using_parent_vm dir=/\S*/ws vm=devvm-ws-[0-9a-f]{14}$' stub_calls -stdout '^limactl shell --workdir /\S*/ws/frontend devvm-ws-[0-9a-f]{14}$' +stdout '^limactl shell --start=false --workdir /\S*/ws/frontend devvm-ws-[0-9a-f]{14}$' ! exec devvm host --here stderr '^devvm: no_vm dir=/\S*/ws/frontend$' cd ../empty diff --git a/testdata/script/colorterm.txtar b/testdata/script/colorterm.txtar index f680fe1b..85030840 100644 --- a/testdata/script/colorterm.txtar +++ b/testdata/script/colorterm.txtar @@ -8,31 +8,31 @@ project web env COLORTERM=truecolor exec devvm --network open --no-git-protect --agents codex stub_calls -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14} sh -c export COLORTERM=''truecolor'' && exec "\$SHELL" --login\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14} sh -c export COLORTERM=''truecolor'' && exec "\$SHELL" --login\n\z' # A shell in the running VM. env COLORTERM=24bit stub_reset exec devvm stub_calls -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14} sh -c export COLORTERM=''24bit'' && exec "\$SHELL" --login\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14} sh -c export COLORTERM=''24bit'' && exec "\$SHELL" --login\n\z' # Any other value, or none: nothing. env COLORTERM='truecolor'';touch /tmp/p' stub_reset exec devvm stub_calls -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' env COLORTERM=256color stub_reset exec devvm stub_calls -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' env COLORTERM= stub_reset exec devvm stub_calls -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' # An agent's login, with truecolor, then with another value. (The stub # saves no login, so devvm says so.) diff --git a/testdata/script/devcontainer.txtar b/testdata/script/devcontainer.txtar index f8fc60e0..2b00c184 100644 --- a/testdata/script/devcontainer.txtar +++ b/testdata/script/devcontainer.txtar @@ -74,8 +74,8 @@ stdout '^==> creating_from image=docker\+extra vm=devvm-web-[0-9a-f]{14}$' # the shell. stdout '^==> running_script script=onCreateCommand what=devvm-web-[0-9a-f]{14}\n==> running_script script=postCreateCommand a what=devvm-web-[0-9a-f]{14}\n==> running_script script=postCreateCommand b what=devvm-web-[0-9a-f]{14}\n==> running_script script=postStartCommand what=devvm-web-[0-9a-f]{14}\n' stub_calls -stdout '^limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/\S*/web'' && exec ''bash'' ''-lc'' ''exec "\$@"'' ''devvm'' ''sh'' ''-c'' ''echo made > ~/made''\n' -stdout '^limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/\S*/web'' && exec ''bash'' ''-lc'' ''exec "\$@"'' ''devvm'' ''touch'' ''b''\nlimactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/\S*/web'' && exec ''bash'' ''-lc'' ''exec "\$@"'' ''devvm'' ''sh'' ''-c'' ''echo started >> ~/started''\n(limactl list --json\n)*limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/\S*/web'' && exec ''bash'' ''-lc'' ''exec "\$@"'' ''devvm'' ''sh'' ''-c'' ''echo made > ~/made''\n' +stdout '^limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/\S*/web'' && exec ''bash'' ''-lc'' ''exec "\$@"'' ''devvm'' ''touch'' ''b''\nlimactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/\S*/web'' && exec ''bash'' ''-lc'' ''exec "\$@"'' ''devvm'' ''sh'' ''-c'' ''echo started >> ~/started''\n(limactl list --json\n)*limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' ! stdout pwned # Its variables are in its environment file, before devvm's own. exec tar -xOf $STUB_DIR/sync.tar env @@ -144,7 +144,7 @@ stderr '^devvm: devcontainer_command_failed command=postCreateCommand a vm=devvm ! stdout 'running_script script=postCreateCommand b' stdout '^==> running_script script=postStartCommand what=devvm-fail-[0-9a-f]{14}$' stub_calls -stdout '^limactl shell --workdir /\S*/fail devvm-fail-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/fail devvm-fail-[0-9a-f]{14}\n\z' rm $STUB_DIR/shell-fails-on # --no-devcontainer: the file isn't read (this one would be refused), and diff --git a/testdata/script/existing.txtar b/testdata/script/existing.txtar index 0d4ca8f3..0a29d172 100644 --- a/testdata/script/existing.txtar +++ b/testdata/script/existing.txtar @@ -15,8 +15,8 @@ exec devvm [linux] stderr '\Adevvm: git_unprotected vm=devvm-web-[0-9a-f]{14}\n\z' stub_calls ! stdout 'limactl (start|stop|clone|create|edit|delete)' -stdout '^limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c .*tar -xf - ' -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c .*tar -xf - ' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' exec grep -c '^devvm-web-' $WEB_dir/run/known_hosts stdout '^1$' @@ -66,7 +66,7 @@ exec devvm restart stdout '^==> starting what=devvm-web-[0-9a-f]{14}$' stub_calls stdout '^limactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n' -stdout '^limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' # --tools, --agents and --layers change nothing on a VM that exists: it # opens as it is, warning that devvm tools changes its shared tools and diff --git a/testdata/script/fixture_v010.txtar b/testdata/script/fixture_v010.txtar index 6b3b2cfc..20362815 100644 --- a/testdata/script/fixture_v010.txtar +++ b/testdata/script/fixture_v010.txtar @@ -165,7 +165,7 @@ stdout '^limactl edit --tty=false devvm-app-[0-9a-f]{14} --set \.ssh\.localPort= ! stdout '(?s)limactl edit .*limactl edit' ! stdout 'limactl (create|clone|delete)' [darwin] stdout '^chflags -R -P uchg \S*/home/src/app/\.git/config$' -stdout '^limactl shell --workdir \S*/home/src/app devvm-app-[0-9a-f]{14}$' +stdout '^limactl shell --start=false --workdir \S*/home/src/app devvm-app-[0-9a-f]{14}$' # The launch kept every field 0.1.0 wrote, but the start it records and # its ssh port, now one of the sandbox's list. diff --git a/testdata/script/fixture_v010_mount_cache.txtar b/testdata/script/fixture_v010_mount_cache.txtar index e1a55d30..aa5d8a03 100644 --- a/testdata/script/fixture_v010_mount_cache.txtar +++ b/testdata/script/fixture_v010_mount_cache.txtar @@ -33,7 +33,7 @@ stdout '^==> starting what=devvm-app-[0-9a-f]{14}$' stub_calls stdout '^limactl edit --tty=false devvm-app-[0-9a-f]{14} --set \.mounts = \[\{"location":"\S*/app","writable":true,"9p":\{"cache":"none"\}\},' ! stdout '(?s)limactl edit --tty=false devvm-app.*limactl edit --tty=false devvm-app' -stdout '^limactl start --tty=false devvm-app-[0-9a-f]{14}\n(.*\n)*limactl shell --workdir / devvm-app-[0-9a-f]{14} sudo sh -c umount ''\S*/app'' \|\| exit 3; mount ' +stdout '^limactl start --tty=false devvm-app-[0-9a-f]{14}\n(.*\n)*limactl shell --start=false --workdir / devvm-app-[0-9a-f]{14} sudo sh -c umount ''\S*/app'' \|\| exit 3; mount ' exec devvm mount-cache --json stdout '\A{\n "version": 1,\n "mode": "none",\n "chosen": true\n}\n\z' diff --git a/testdata/script/fixture_v010_renumbered.txtar b/testdata/script/fixture_v010_renumbered.txtar index 5ceb0d62..1a38ef98 100644 --- a/testdata/script/fixture_v010_renumbered.txtar +++ b/testdata/script/fixture_v010_renumbered.txtar @@ -26,7 +26,7 @@ stdout '^==> starting what=devvm-app-[0-9a-f]{14}$' ! stderr 'unreadable|corrupt|layout_|moved|replaced|refused|failed|other_folder|folder_changed' stub_calls stdout '^limactl start --tty=false devvm-app-[0-9a-f]{14}$' -stdout '^limactl shell --workdir \S*/home/src/app devvm-app-[0-9a-f]{14}$' +stdout '^limactl shell --start=false --workdir \S*/home/src/app devvm-app-[0-9a-f]{14}$' vm_state $APP_dir/vm.json stdout '^folder='$FOLDER_ID'$' stdout '^folder_volume=uuid:EC5E5014-21A3-4154-ACE8-0C8C1C254852:[0-9]+:[0-9]+\.[0-9]+$' diff --git a/testdata/script/fixture_v010_small.txtar b/testdata/script/fixture_v010_small.txtar index d0a0b23a..b70a448c 100644 --- a/testdata/script/fixture_v010_small.txtar +++ b/testdata/script/fixture_v010_small.txtar @@ -114,7 +114,7 @@ exec devvm stdout '^==> starting what='$APP'$' ! stderr 'unreadable|corrupt|refused|failed|folder_changed|other_folder' stub_calls -stdout '^limactl shell --workdir \S*/home/src/app-moved '$APP'$' +stdout '^limactl shell --start=false --workdir \S*/home/src/app-moved '$APP'$' exec devvm stop -- reasons.sh -- diff --git a/testdata/script/from.txtar b/testdata/script/from.txtar index 16bd5534..0866060e 100644 --- a/testdata/script/from.txtar +++ b/testdata/script/from.txtar @@ -43,10 +43,10 @@ stdout '^limactl start --tty=false devvm-oci-build$' # With HTTPS_PROXY set, the build goes through a proxy of devvm's, which # alone has the host's proxy settings: the script reads that proxy's # address on its input first, then runs with its arguments. -stdout '^limactl shell --workdir / devvm-oci-build sudo bash -s -- /\S*/tmp/devvm-oci\.[0-9]+/oci/build\.sh /\S*/tmp/devvm-oci\.[0-9]+/oci /\S*/tmp/devvm-oci\.[0-9]+/vm node:24@sha256:a{64} node:24@sha256:a{64} \S+ [0-9]+ /home/\S+\.guest 20G$' +stdout '^limactl shell --start=false --workdir / devvm-oci-build sudo bash -s -- /\S*/tmp/devvm-oci\.[0-9]+/oci/build\.sh /\S*/tmp/devvm-oci\.[0-9]+/oci /\S*/tmp/devvm-oci\.[0-9]+/vm node:24@sha256:a{64} node:24@sha256:a{64} \S+ [0-9]+ /home/\S+\.guest 20G$' stdout '^limactl delete -f devvm-oci-build\nlimactl create --tty=false --mount-none --name=devvm-img-[0-9a-f]{12} --set \.images = \[\{"location":"/\S*/tmp/devvm-oci\.[0-9]+/vm/disk\.raw","arch":"(aarch64|x86_64)","kernel":\{"location":"/\S*/tmp/devvm-oci\.[0-9]+/vm/kernel","cmdline":"root=/dev/vda rw console=hvc0"\},"initrd":\{"location":"/\S*/tmp/devvm-oci\.[0-9]+/vm/initrd"\}\}\] --cpus=4 --memory=8 --disk=100 -$' cmp $STUB_DIR/create-template $DEVVM_REPO/assets/base.yaml -stdout '^limactl shell devvm-img-[0-9a-f]{12} bash -s$' +stdout '^limactl shell --start=false devvm-img-[0-9a-f]{12} bash -s$' exec sh -c 'ls "$TMPDIR"' ! stdout . # The builds' proxies are gone, with their files. @@ -127,7 +127,7 @@ stub_calls stdout '^docker image inspect --format \{\{\.Id\}\} myapp:dev$' stdout '^docker info$' stdout '^docker save -o /\S*/tmp/devvm-oci\.[0-9]+/vm/image\.tar myapp:dev$' -stdout '^limactl shell --workdir / devvm-oci-build sudo bash -s -- /\S*/tmp/devvm-oci\.[0-9]+/oci/build\.sh /\S*/tmp/devvm-oci\.[0-9]+/oci /\S*/tmp/devvm-oci\.[0-9]+/vm - myapp:dev ' +stdout '^limactl shell --start=false --workdir / devvm-oci-build sudo bash -s -- /\S*/tmp/devvm-oci\.[0-9]+/oci/build\.sh /\S*/tmp/devvm-oci\.[0-9]+/oci /\S*/tmp/devvm-oci\.[0-9]+/vm - myapp:dev ' exec sh -c 'ls -t "$XDG_DATA_HOME"/devvm/logs/runs/*.log | head -1 | xargs cat' stdout '^# \[1/15\] exporting_docker from=myapp:dev$' stdout '^# \[15/15\] stopping vm=devvm-img-' diff --git a/testdata/script/host_code.txtar b/testdata/script/host_code.txtar index be646f3a..6a88ad8f 100644 --- a/testdata/script/host_code.txtar +++ b/testdata/script/host_code.txtar @@ -29,7 +29,7 @@ stdout '^ssh_host_info dir=/\S*/web host=devvm-web$' stub_calls stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}$' stdout 'tar -xf' -! stdout 'limactl shell --workdir /\S*/web devvm-web' +! stdout 'limactl shell --start=false --workdir /\S*/web devvm-web' catg $DATA/ssh_config stdout '^Host devvm-web devvm-web-[0-9a-f]{14}$' ! exists $HOME/.ssh diff --git a/testdata/script/layer_add.txtar b/testdata/script/layer_add.txtar index af616061..350b44aa 100644 --- a/testdata/script/layer_add.txtar +++ b/testdata/script/layer_add.txtar @@ -64,7 +64,7 @@ stdout '==> remade image=docker vm=devvm-web-[0-9a-f]{14}$' stdout '^==> building_image image=docker ' stub_calls stdout 'exec ''bash'' ''-c'' ''if IFS= read -r n .*\n(.*\n)*.*tar -czf - --one-file-system.*\n(.*\n)*limactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n' -stdout 'limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n(.*\n)*limactl clone --tty=false devvm-img-[0-9a-f]+ devvm-web-[0-9a-f]{14} .*\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*.*tar -xzf - --skip-old-files.*\n(.*\n)*limactl delete -f devvm-[0-9a-f]{14}-old\n(.*\n)*limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' +stdout 'limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n(.*\n)*limactl clone --tty=false devvm-img-[0-9a-f]+ devvm-web-[0-9a-f]{14} .*\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*.*tar -xzf - --skip-old-files.*\n(.*\n)*limactl delete -f devvm-[0-9a-f]{14}-old\n(.*\n)*limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' vm_state $WEB_dir/vm.json stdout '^image=docker$' stdout '^ports.forward=3000,5173$' diff --git a/testdata/script/layer_rm.txtar b/testdata/script/layer_rm.txtar index 6f1c22ed..9ba34f55 100644 --- a/testdata/script/layer_rm.txtar +++ b/testdata/script/layer_rm.txtar @@ -64,7 +64,7 @@ stdout '==> saving_home vm=devvm-web-[0-9a-f]{14}$' stdout '==> creating_from image=docker\+foo vm=devvm-web-[0-9a-f]{14}$' stdout '==> remade image=docker\+foo vm=devvm-web-[0-9a-f]{14}$' stub_calls -stdout 'limactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n(.*\n)*limactl clone --tty=false devvm-img-[0-9a-f]+ devvm-web-[0-9a-f]{14} .*\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*.*tar -xzf - --skip-old-files.*\n(.*\n)*limactl delete -f devvm-[0-9a-f]{14}-old\n(.*\n)*limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' +stdout 'limactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n(.*\n)*limactl clone --tty=false devvm-img-[0-9a-f]+ devvm-web-[0-9a-f]{14} .*\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*.*tar -xzf - --skip-old-files.*\n(.*\n)*limactl delete -f devvm-[0-9a-f]{14}-old\n(.*\n)*limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' vm_state $WEB_dir/vm.json stdout '^image=docker\+foo$' stdout '^ports.forward=3000$' diff --git a/testdata/script/mount_cache.txtar b/testdata/script/mount_cache.txtar index a25dce1b..08cf7be2 100644 --- a/testdata/script/mount_cache.txtar +++ b/testdata/script/mount_cache.txtar @@ -96,8 +96,8 @@ exec devvm stub_calls stdout '^limactl edit --tty=false devvm-web-[0-9a-f]{14} --set \.mounts = \[\{"location":"\S*/web","writable":true,"9p":\{"cache":"none"\}\},' ! stdout '(?s)limactl edit --tty=false devvm-web.*limactl edit --tty=false devvm-web' -stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*limactl shell --workdir / devvm-web-[0-9a-f]{14} sudo sh -c umount ''\S*/web'' \|\| exit 3; mount ' -stdout '^limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c if mountpoint -q ''\S*/web''; then P=''\S*/web'' awk .* /proc/self/mountinfo; ' +stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sudo sh -c umount ''\S*/web'' \|\| exit 3; mount ' +stdout '^limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c if mountpoint -q ''\S*/web''; then P=''\S*/web'' awk .* /proc/self/mountinfo; ' exec devvm mount-cache stdout '\Anone\n\z' ! stderr . @@ -120,7 +120,7 @@ stub_reset ! exec devvm stderr '^devvm: mount_cache_unmounted vm=devvm-web-[0-9a-f]{14}$' stub_calls -! stdout '^limactl shell --workdir \S*/web devvm-web' +! stdout '^limactl shell --start=false --workdir \S*/web devvm-web' stdout '(?s)sudo sh -c umount .*\nlimactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*limactl stop devvm-web-[0-9a-f]{14}\n' ! stdout '(?s)sudo sh -c umount .*sudo sh -c umount ' ! stdout '(?s)(limactl start --tty=false devvm-web.*){3}' @@ -144,7 +144,7 @@ exec devvm stderr -count=1 '^devvm: policy_not_rule file=\S*/policy line=\d+ rule=example\.com:x$' exec sh -c 'grep -v "example.com:x" "$CFG/policy" > "$WORK/p"; cat "$WORK/p" > "$CFG/policy"' stub_calls -stdout '(?s)sudo sh -c umount .*\nlimactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*limactl shell --workdir \S*/web devvm-web-[0-9a-f]{14}\n' +stdout '(?s)sudo sh -c umount .*\nlimactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*limactl shell --start=false --workdir \S*/web devvm-web-[0-9a-f]{14}\n' ! stdout '(?s)sudo sh -c umount .*sudo sh -c umount ' exec sh -c 'cat "$DATA"/logs/runs/*.log' stdout 'devvm: devvm-web-[0-9a-f]{14}''s project folder after its remount: it isn''t mounted; restarting the VM$' @@ -162,7 +162,7 @@ stub_reset ! exec devvm stderr '^devvm: project_unmounted vm=devvm-web-[0-9a-f]{14}$' stub_calls -! stdout '^limactl shell --workdir \S*/web devvm-web' +! stdout '^limactl shell --start=false --workdir \S*/web devvm-web' rm $STUB_DIR/mount-unmounted # A stored mmap, as a build of devvm before none alone wrote, is none @@ -203,7 +203,7 @@ stderr '^devvm: git_strict_converted vm=devvm-app-[0-9a-f]{14}$' stub_calls stdout '^limactl edit --tty=false devvm-app-[0-9a-f]{14} --set \.mounts = \[\{"location":"\S*/app","writable":true,"9p":\{"cache":"none"\}\},' ! stdout '(?s)limactl edit --tty=false devvm-app.*limactl edit --tty=false devvm-app' -stdout '^limactl start --tty=false devvm-app-[0-9a-f]{14}\n(.*\n)*limactl shell --workdir / devvm-app-[0-9a-f]{14} sudo sh -c umount ''\S*/app'' \|\| exit 3; mount ' +stdout '^limactl start --tty=false devvm-app-[0-9a-f]{14}\n(.*\n)*limactl shell --start=false --workdir / devvm-app-[0-9a-f]{14} sudo sh -c umount ''\S*/app'' \|\| exit 3; mount ' vm_state $APP_dir/vm.json stdout '^git\.mode=on$' stdout '^mount\.cache=none$' diff --git a/testdata/script/move.txtar b/testdata/script/move.txtar index c91aca27..8a3002c6 100644 --- a/testdata/script/move.txtar +++ b/testdata/script/move.txtar @@ -48,7 +48,7 @@ exec devvm stub_calls [darwin] stdout '^limactl edit --tty=false devvm-web-[0-9a-f]{14} --set \.mounts = \[\{"location":"/\S*/site","writable":true\}' [linux] stdout '^limactl edit --tty=false devvm-web-[0-9a-f]{14} --set \.mounts = \[\{"location":"/\S*/site","writable":true,"9p":\{"cache":"none"\}\}' -stdout '^limactl shell --workdir /\S*/site devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/site devvm-web-[0-9a-f]{14}\n\z' exec tar -xOf $STUB_DIR/sync.tar moved stdout '^moved_from=''/\S*/web''\nmoved_to=''/\S*/site''\nclaude_from=''-\S*-web''\nclaude_to=''-\S*-site''\n\z' ! grep '"moved"' $WEB_dir/vm.json diff --git a/testdata/script/nested_replaced.txtar b/testdata/script/nested_replaced.txtar index 829b0a1c..3e9ddc68 100644 --- a/testdata/script/nested_replaced.txtar +++ b/testdata/script/nested_replaced.txtar @@ -62,4 +62,4 @@ stub_reset exec devvm stub_calls stdout '^limactl start .*devvm-inner-[0-9a-f]{14}$' -stdout '^limactl shell --workdir /\S*/app/inner devvm-inner-[0-9a-f]{14}$' +stdout '^limactl shell --start=false --workdir /\S*/app/inner devvm-inner-[0-9a-f]{14}$' diff --git a/testdata/script/network.txtar b/testdata/script/network.txtar index 4c252eba..bc01a090 100644 --- a/testdata/script/network.txtar +++ b/testdata/script/network.txtar @@ -57,8 +57,8 @@ stub_calls [darwin] stdout '^tmutil addexclusion \S*/data/devvm/vms/[0-9a-f]{14}/run/ca$' [darwin] stdout '^limactl edit --tty=false devvm-net-[0-9a-f]{14} --set \.env = \{"HTTPS_PROXY":"http://devvm:devvm-proxy-password@192\.168\.5\.2:[0-9]+",.*"NODE_EXTRA_CA_CERTS":"/etc/ssl/devvm\.pem",.*"NO_PROXY":"localhost,127\.0\.0\.1,::1",.*\} --set \.propagateProxyEnv=false --set \.hostResolver\.enabled=false --set \.dns=\["127\.0\.0\.1"\]$' [linux] stdout '^limactl edit --tty=false devvm-net-[0-9a-f]{14} --set \.env = \{"HTTPS_PROXY":"http://devvm:devvm-proxy-password@192\.168\.5\.4:3128",.*\} --set \.propagateProxyEnv=false --set \.hostResolver\.enabled=false --set \.dns=\["127\.0\.0\.1"\]$' -stdout '^limactl start --tty=false devvm-net-[0-9a-f]{14}\n(limactl list --json\n)*limactl shell --workdir / devvm-net-[0-9a-f]{14} sh -c .*/etc/ssh/ssh_host_.*\n(limactl list --json\n)*ssh -F none -M .*\nlimactl shell --workdir / devvm-net-[0-9a-f]{14} sh -c cd ''/'' && exec ''curl'' ''--noproxy'' ''\*'' ''-sS'' ''-m'' ''3'' ''-o'' ''/dev/null'' ''https://1\.1\.1\.1''\n' -stdout '^limactl shell --workdir /\S*/net devvm-net-[0-9a-f]{14}\n\z' +stdout '^limactl start --tty=false devvm-net-[0-9a-f]{14}\n(limactl list --json\n)*limactl shell --start=false --workdir / devvm-net-[0-9a-f]{14} sh -c .*/etc/ssh/ssh_host_.*\n(limactl list --json\n)*ssh -F none -M .*\nlimactl shell --start=false --workdir / devvm-net-[0-9a-f]{14} sh -c cd ''/'' && exec ''curl'' ''--noproxy'' ''\*'' ''-sS'' ''-m'' ''3'' ''-o'' ''/dev/null'' ''https://1\.1\.1\.1''\n' +stdout '^limactl shell --start=false --workdir /\S*/net devvm-net-[0-9a-f]{14}\n\z' # The password is in no command's arguments: devvm wrote it into lima.yaml, # the user's alone. exec sh -c 'key=$(sed -n "s/^ *\"proxy_key\": \"\(.*\)\".*/\1/p" "$NET_dir/vm.json"); test -n "$key" && ! grep -qF "$key" "$STUB_LOG" && grep -qF "\"HTTPS_PROXY\":\"http://devvm:$key@" "$LIMA_HOME"/devvm-net-*/lima.yaml && ! grep -q devvm-proxy-password "$LIMA_HOME"/devvm-net-*/lima.yaml && ls -l "$LIMA_HOME"/devvm-net-*/lima.yaml' @@ -112,7 +112,7 @@ stderr '^devvm: net_direct_route vm=devvm-leak-[0-9a-f]{14}$' stub_calls stdout '^limactl stop devvm-leak-[0-9a-f]{14}$' ! stdout 'tar -xf' -! stdout 'limactl shell --workdir /\S*/leak' +! stdout 'limactl shell --start=false --workdir /\S*/leak' vm_name LEAK leak vm_state $LEAK_dir/vm.json stdout '^net\.made\.check=unenforced$' @@ -131,7 +131,7 @@ stderr '^devvm: net_proxy_down_stopped vm=devvm-net-[0-9a-f]{14}$' stderr '^devvm: proxy_port_taken port=[0-9]+ vm=devvm-net-[0-9a-f]{14}$' stub_calls stdout '^limactl stop devvm-net-[0-9a-f]{14}$' -! stdout 'limactl shell --workdir /\S*/net' +! stdout 'limactl shell --start=false --workdir /\S*/net' exec sh -c 'kill "$(cat "$WORK/squat.pid")"' # Secrets: claude comes with Claude Code. The proxy gets its binding, with diff --git a/testdata/script/paste_rm.txtar b/testdata/script/paste_rm.txtar index 5c4c5d11..a2695efa 100644 --- a/testdata/script/paste_rm.txtar +++ b/testdata/script/paste_rm.txtar @@ -108,7 +108,7 @@ stderr '^paste_launch_ask count=3 dir=/tmp/devvm-paste vm=devvm-plain-[0-9a-f]{1 stdout '^==> paste_rm_done count=3 dir=/tmp/devvm-paste vm=devvm-plain-[0-9a-f]{14}$' stub_calls stdout 'tar -xf - (.*\n)*.*''devvm-paste'' ''count'' ''/tmp/devvm-paste''' -stdout '''devvm-paste'' ''rm'' ''/tmp/devvm-paste''\nlimactl shell --workdir \S*/plain devvm-plain-[0-9a-f]{14}$' +stdout '''devvm-paste'' ''rm'' ''/tmp/devvm-paste''\nlimactl shell --start=false --workdir \S*/plain devvm-plain-[0-9a-f]{14}$' # A delete that fails after the yes is a warning, as a count that fails # is, and the launch goes on into the VM's shell. @@ -121,7 +121,7 @@ stderr 'paste_launch_ask count=3 dir=/tmp/devvm-paste vm=devvm-plain-[0-9a-f]{14 stderr 'devvm: paste_rm_not_done dir=/tmp/devvm-paste vm=devvm-plain-[0-9a-f]{14}' ! stdout 'paste_rm_done' stub_calls -stdout 'limactl shell --workdir \S*/plain devvm-plain-[0-9a-f]{14}$' +stdout 'limactl shell --start=false --workdir \S*/plain devvm-plain-[0-9a-f]{14}$' rm $STUB_DIR/shell-fails-on # A stopped VM with nothing pasted: started without a question. diff --git a/testdata/script/subfolder.txtar b/testdata/script/subfolder.txtar index 8773acbc..384c5dd6 100644 --- a/testdata/script/subfolder.txtar +++ b/testdata/script/subfolder.txtar @@ -17,7 +17,7 @@ stdout '^==> using_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$' ! stdout creating stub_calls ! stdout 'limactl (clone|create)' -stdout '^limactl shell --workdir /\S*/app/src/lib devvm-app-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/app/src/lib devvm-app-[0-9a-f]{14}\n\z' exec sh -c 'ls "$VMS" | wc -l' stdout '^ *1$' @@ -42,7 +42,7 @@ stub_reset exec devvm ! stdout using_parent_vm stub_calls -stdout '^limactl shell --workdir /\S*/app/src devvm-src-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/app/src devvm-src-[0-9a-f]{14}\n\z' # The nearest folder with a VM wins. cd $WORK/app/src/lib @@ -63,7 +63,7 @@ stub_reset exec devvm --parent stdout '^==> using_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}$' stub_calls -stdout '^limactl shell --workdir /\S*/app/tool/bin devvm-app-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir /\S*/app/tool/bin devvm-app-[0-9a-f]{14}\n\z' exec devvm stop --parent stdout '^==> using_parent_vm dir=/\S*/app vm=devvm-app-[0-9a-f]{14}\n==> stopped vm=devvm-app-[0-9a-f]{14}$' exec devvm --network open diff --git a/testdata/script/tools.txtar b/testdata/script/tools.txtar index 5ae80bdf..ee34050e 100644 --- a/testdata/script/tools.txtar +++ b/testdata/script/tools.txtar @@ -22,7 +22,7 @@ stdout '^mise lock --platform linux-(arm64|x64),linux-(arm64|x64)-musl$' # and goes before the next tool's is made. stdout '^limactl clone --tty=false --mount-none --set \.mounts = \[\{"location":"\S*/data/devvm/tools-build\.[0-9]+","mountPoint":"/mnt/devvm-tools","writable":true,"9p":\{"cache":"none"\}\}\] devvm-img-[0-9a-f]{12} devvm-tools-build$' ! stdout '"location":"\S*/data/devvm/tools","mountPoint":"/mnt/devvm-tools","writable":true' -stdout '^limactl shell --workdir / devvm-tools-build bash -s -- node 24\.21\.0 node-24\.21\.0-[0-9a-f]{12}\.erofs\n(.*\n)*limactl delete -f devvm-tools-build\n(.*\n)*limactl clone .* devvm-tools-build\n(.*\n)*limactl shell --workdir / devvm-tools-build bash -s -- pnpm \S+ pnpm-\S+\.erofs\n(.*\n)*limactl shell --workdir / devvm-tools-build bash -s -- bun 1\.4\.2 bun-1\.4\.2-[0-9a-f]{12}\.erofs\n(.*\n)*limactl shell --workdir / devvm-tools-build bash -s -- claude 2\.1\.295 claude-2\.1\.295-[0-9a-f]{12}\.erofs\n(.*\n)*limactl delete -f devvm-tools-build$' +stdout '^limactl shell --start=false --workdir / devvm-tools-build bash -s -- node 24\.21\.0 node-24\.21\.0-[0-9a-f]{12}\.erofs\n(.*\n)*limactl delete -f devvm-tools-build\n(.*\n)*limactl clone .* devvm-tools-build\n(.*\n)*limactl shell --start=false --workdir / devvm-tools-build bash -s -- pnpm \S+ pnpm-\S+\.erofs\n(.*\n)*limactl shell --start=false --workdir / devvm-tools-build bash -s -- bun 1\.4\.2 bun-1\.4\.2-[0-9a-f]{12}\.erofs\n(.*\n)*limactl shell --start=false --workdir / devvm-tools-build bash -s -- claude 2\.1\.295 claude-2\.1\.295-[0-9a-f]{12}\.erofs\n(.*\n)*limactl delete -f devvm-tools-build$' exec sh -c 'grep -c "^limactl clone .* devvm-tools-build$" "$STUB_LOG"' stdout '^4$' stub_calls @@ -112,7 +112,7 @@ vm_state $SHOP_dir/vm.json stdout '^tools.names=dotnet$' stdout '^tools.made.files=dotnet-10\.0\.401-[0-9a-f]{12}\.erofs$' stub_calls -stdout '^limactl shell --workdir / devvm-tools-build bash -s -- dotnet 10\.0\.401 dotnet-10\.0\.401-[0-9a-f]{12}\.erofs https://builds\.dotnet\.microsoft\.com/dotnet/Sdk/10\.0\.401/dotnet-sdk-10\.0\.401-linux-(arm64|x64)\.tar\.gz [0-9a-f]{128}$' +stdout '^limactl shell --start=false --workdir / devvm-tools-build bash -s -- dotnet 10\.0\.401 dotnet-10\.0\.401-[0-9a-f]{12}\.erofs https://builds\.dotnet\.microsoft\.com/dotnet/Sdk/10\.0\.401/dotnet-sdk-10\.0\.401-linux-(arm64|x64)\.tar\.gz [0-9a-f]{128}$' # global.json alone calls for it too. project sdk cp $WORK/global.json global.json diff --git a/testdata/script/up.txtar b/testdata/script/up.txtar index ff6c6d3d..a90bac38 100644 --- a/testdata/script/up.txtar +++ b/testdata/script/up.txtar @@ -32,10 +32,10 @@ stdout '^limactl clone --tty=false devvm-img-[0-9a-f]{12} devvm-web-[0-9a-f]{14} stdout -count=1 'limactl edit --tty=false devvm-web' stdout '^limactl edit --tty=false devvm-web-[0-9a-f]{14} --set \.env = \{"HTTPS_PROXY":"http://devvm:devvm-proxy-password@192\.168\.5\.2:[0-9]+",.* --set \.propagateProxyEnv=false$' ! stdout 'devvm-tools-build' -stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}\n(limactl list --json\n)*limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c .*/etc/ssh/ssh_host_.*\n' +stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}\n(limactl list --json\n)*limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c .*/etc/ssh/ssh_host_.*\n' stdout '^ssh -F none -M -S \S+/data/devvm/run/port-[0-9a-f]{16}\.ctl -T .* -o IdentityFile=\S+/lima/_config/user .* -o UserKnownHostsFile=\S+/data/devvm/vms/[0-9a-f]{14}/run/known_hosts .* -o HostKeyAlias=devvm-web-[0-9a-f]{14} .* -p 60022 -l stub 127\.0\.0\.1 sh -s$' ! stdout '^docker ' -stdout '^limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/'' && exec ''bash'' ''-c'' ''d=\$\(mktemp -d\); tar -xf - .*''\n(limactl list --json\n)+limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' +stdout '^limactl shell --start=false --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/'' && exec ''bash'' ''-c'' ''d=\$\(mktemp -d\); tar -xf - .*''\n(limactl list --json\n)+limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z' exists $XDG_DATA_HOME/devvm/tools ! exists $XDG_DATA_HOME/devvm/mise.lock # .git's hooks and config locked (macOS); elsewhere, not. @@ -137,7 +137,7 @@ stdout '^limactl delete -f devvm-slow-[0-9a-f]{14}$' [darwin] stdout '^chflags -R -P nouchg /\S*/slow/\.git/hooks$' ! stdout 'delete -f devvm-(web|api)' ! stdout 'nouchg /\S*/(web|api)/' -! stdout 'limactl shell --workdir' +! stdout 'limactl shell --start=false --workdir' exec sh -c 'cat "$VMS"/*/vm.json' ! stdout devvm-slow stdout '"name": "devvm-web-' diff --git a/testdata/script/update.txtar b/testdata/script/update.txtar index e912ff10..aaf7c264 100644 --- a/testdata/script/update.txtar +++ b/testdata/script/update.txtar @@ -41,7 +41,7 @@ stdout '^==> tools_switch vm=devvm-web-[0-9a-f]{14}$' ! stderr remake_confirm stub_calls ! stdout 'limactl (stop|rename|clone|delete)' -stdout 'limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' +stdout 'limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' vm_state $WEB_dir/vm.json ! stdout 'claude-1\.0\.0' @@ -68,7 +68,7 @@ stderr '^remake_confirm image=foo vm=devvm-web-[0-9a-f]{14} \[y/N\] ' stdout '==> kept vm=devvm-web-[0-9a-f]{14}$' stub_calls ! stdout 'limactl (stop|rename|clone|delete)' -stdout 'limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' +stdout 'limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' vm_state $WEB_dir/vm.json ! stdout 'claude-1\.0\.0' @@ -83,7 +83,7 @@ stdout '==> saving_home vm=devvm-web-[0-9a-f]{14}$' stdout '==> creating_from image=foo vm=devvm-web-[0-9a-f]{14}$' stdout '==> remade image=foo vm=devvm-web-[0-9a-f]{14}$' stub_calls -stdout 'tar -czf - --one-file-system.*\n(.*\n)*limactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n(.*\n)*limactl clone --tty=false devvm-img-[0-9a-f]+ devvm-web-[0-9a-f]{14} .*\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*.*tar -xzf - --skip-old-files.*\n(.*\n)*limactl delete -f devvm-[0-9a-f]{14}-old\n(.*\n)*limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' +stdout 'tar -czf - --one-file-system.*\n(.*\n)*limactl stop devvm-web-[0-9a-f]{14}\n(.*\n)*limactl rename --tty=false devvm-web-[0-9a-f]{14} devvm-[0-9a-f]{14}-old\n(.*\n)*limactl clone --tty=false devvm-img-[0-9a-f]+ devvm-web-[0-9a-f]{14} .*\n(.*\n)*limactl start --tty=false devvm-web-[0-9a-f]{14}\n(.*\n)*.*tar -xzf - --skip-old-files.*\n(.*\n)*limactl delete -f devvm-[0-9a-f]{14}-old\n(.*\n)*limactl shell --start=false --workdir /\S*/web devvm-web-[0-9a-f]{14}\n' vm_state $WEB_dir/vm.json stdout '^image=foo$' stdout '^ports.forward=3000$'