Files
w3cjandClaude Opus 5.5 90a64a44d1 fix(races): lock order checked, sandboxes' own ports, pins that meet a rename, daemons' groups stopped
- state: test builds and tests check the state locks' order (state.held, CheckLockOrder): a second VM's lock, a VM's lock under the claims lock, or a lock taken again panics before waiting.
- platform: PinBeneath opens the path again when a rename takes the file away before move_mount (ENOENT), so the keeper no longer reports a false lost pin (TestPinsInNamespace's 'f lost / f pinned-again'); TestPinWhileRenamed.
- daemon: Proc.Stop signals the process group (SignalGroup), so forwarders' and link sessions' ssh masters and relays end with them; ui.UI.StopsItsOwn makes _ports and _links wait for their ssh on an outside SIGTERM.
- vm: gc --orphans and devvm space count forwarders' leftover control sockets (vmssh.ControlGlob).
- CLI tests: each sandbox claims a block of ports below devvm's range and the ephemeral range (claimPortBlock, /tmp/devvm-test-ports); free_port, the fixtures' ports and DEVVM_SSH_PORTS come from it, and the sandbox's devvm chooses from its own range (DEVVM_PORT_RANGE override). Fixtures' forwarded ports and settings ports are rewritten too (FIXTURE_PORT_<port>).
- netpolicy and vm tests: the fake proxy's stop waits for its reap, and fake daemons run until the test ends, not 30 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:31 -07:00

34 lines
1018 B
Go

package cli
import (
"github.com/spf13/cobra"
"github.com/devvmhq/devvm/internal/msg"
"github.com/devvmhq/devvm/internal/vm"
"github.com/devvmhq/devvm/internal/vmname"
)
// newLinksCmd is devvm _links VM: the link session of a running client
// VM, which carries its links to other VMs' ports until the VM stops or
// has none (vm.Links.Session). devvm starts it detached; its log lines are
// data, written to devvm's stderr. Hidden: it's not for users. A signal
// waits for it to stop its ssh masters (ui.UI.StopsItsOwn).
func newLinksCmd(a *app) *cobra.Command {
return &cobra.Command{
Use: "_links VM",
Short: "Carry a VM's links to other VMs",
Hidden: true,
Args: exactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
a.u.StopsItsOwn()
return a.env(func(env *vm.Env) error {
name, err := vmname.Parse(args[0])
if err != nil {
return err
}
return vm.Links{Env: env}.Session(cmd.Context(), name, a.u.Stderr())
}, msg.LinkSessionFailed)
},
}
}