mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
In a terminal, limactl shell of a stopped VM asks whether to start it, yes by default (Lima 2.3.0, reproduced under a pty), and that start is Lima's own: no proxy or sandbox-exec profile (no QEMU wrapper on Linux), no pins, and no folderChanged, so the project folder's mount, by path on Linux's 9p, follows a link put at the path or makes a folder that's gone again. devvm opens a shell (Shell) and runs an agent's login (Exec) on the terminal after bringUp, so a guest that powered itself off between the two got that question. This is the start path the self-check's restart was suspected of: that restart goes through startOnce, but limactl shell didn't.
The limactl builder, which every limactl command of devvm's goes through, now gives limactl shell --start=false, which Lima has had since 2.0.0-rc.0 (devvm's oldest is 2.2): a stopped VM's shell or command fails at once ("instance is stopped"), without asking, and devvm's next launch starts it with every check. devvm limactl, which passes its arguments on as given, is unchanged.
TestShellNeverStarts checks Exec's, Shell's and the builder's limactl shell, and fails without the change; the lima package's and the CLI scripts' expected limactl shell calls name the flag, their negative patterns too, so none turns vacuous. Docs: How it works' Lima page's A stopped VM's shell; the changelog's Security hardening gets the line, its summary widened to cover both of its lines, and the release page its section.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
47 lines
2.0 KiB
Plaintext
47 lines
2.0 KiB
Plaintext
# devvm mount-cache on devvm 0.1.0's state (testdata/v0.1.0/GOOS, which
|
|
# 0.1.0 itself made: see fixture_v010.txtar). On a Linux host, app's
|
|
# project folder has Lima's mmap, which 0.1.0 chose nothing about: devvm
|
|
# mount-cache shows it, with the warning, and devvm mount-cache none
|
|
# switches it from its next start, in one edit, with the folder mounted
|
|
# again. macOS has no such choice, which fixture_v010.txtar checks.
|
|
[!linux] skip 'a Linux host''s cache mode'
|
|
env GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t
|
|
mkdir $HOME/src/db $HOME/src/app $HOME/src/web $HOME/src/scratch
|
|
cd $HOME/src/app
|
|
exec git init -q -b main
|
|
exec git commit -q --allow-empty -m one
|
|
fixture v0.1.0
|
|
vm_name APP app
|
|
|
|
exec devvm mount-cache
|
|
stdout '\Ammap\n\z'
|
|
stderr '^devvm: mount_cache_unchosen mode=mmap vm=devvm-app-[0-9a-f]{14}$'
|
|
|
|
# Stopped, it's set for the next start, which makes it in one edit, then
|
|
# mounts the folder again and checks it.
|
|
stub_reset
|
|
exec devvm mount-cache none
|
|
stdout '^==> mount_cache_pending mode=none vm=devvm-app-[0-9a-f]{14}$'
|
|
stub_calls
|
|
! stdout 'limactl (edit|start)'
|
|
vm_state $APP_dir/vm.json
|
|
stdout '^mount\.cache=none$'
|
|
stub_reset
|
|
exec devvm
|
|
stdout '^==> starting what=devvm-app-[0-9a-f]{14}$'
|
|
! stderr 'unreadable|corrupt|layout_|replaced|refused|failed|mount_cache_unchosen'
|
|
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 --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'
|
|
|
|
# The start after that edits nothing.
|
|
exec devvm stop
|
|
stub_reset
|
|
exec devvm
|
|
! stderr mount_cache_unchosen
|
|
stub_calls
|
|
! stdout 'limactl edit'
|