Skip to content

timeout: take the process by mutable pointer, so the Windows build works again - #263

Merged
dy-tea merged 1 commit into
vlang:mainfrom
metif12:fix/main-regressions
Oct 20, 2026
Merged

dy-tea merged 1 commit into
vlang:mainfrom
metif12:fix/main-regressions

Conversation

@metif12

@metif12 metif12 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

main does not build timeout. This is the one-line cause and its fix.

The break

The tip commit c6cbc320b6 ("timeout: fix errors") changed every
terminate_process to take the process by value, but left the two calls
that mutate it:

src/timeout/timeout_windows.c.v:13:3: error: `p` is immutable, declare it with `mut` to make it mutable
src/timeout/timeout_windows.c.v:15:3: error: `p` is immutable, declare it with `mut` to make it mutable
fn terminate_process(p os.Process, sig_num int, process_group bool) {
	if sig_num == 15 {
		p.signal_term()
	} else {
		p.signal_kill()
	}
}

Reproduced on c6cbc320b6: v -o timeout.exe src/timeout fails with exactly
those two errors. The Windows build of timeout is broken on main.

Why it went unnoticed

CI has been failing inside the V compiler's own bootstrap before it compiles
any of this repository, on every job, since early October. Every PR in the
repo shows red, which is what upstream issues
vlang/v#30551,
#30598 and
#30753 track. So there has been no
green signal to catch this.

The fix

The comment already sitting above that function says why a value cannot
work:

A pointer, because signalling a process changes it. Passing it by value, as
the nix version can, made the compiler reference it for us and then reject
that as deprecated automatic referencing.

So the signature is what has to move back, not the comment. All three
platform variants take mut p &os.Process, and both call sites pass mut &p
— which is what the tree had before c6cbc320b6, and the only combination of
those two choices that compiles.

The three variants have to agree, because timeout.v calls whichever one the
target selects from a single shared call site. A mismatch is a build break on
exactly whichever platform picks the odd one out, which is the failure mode
the vinix-cross-build job in #250 is meant to catch.

Verification

  • v -o timeout.exe src/timeout builds on c6cbc320b6 + this commit, and
    does not build on c6cbc320b6 alone.
  • src/timeout passes 1/1 with a real GNU timeout on PATH to compare
    against.
  • v fmt -verify clean on all four files.
  • The diff is five lines: three signatures and two call sites, nothing else.

Note for review

This is deliberately minimal and lands ahead of #250, which was written
against the pre-c6cbc320b6 tree and carries the same signature fix. Once
this merges, #250's src/timeout commit rebases away and that PR is left
carrying only the Vinix build target.

…rks again

main does not build timeout. The tip commit c6cbc32 ("timeout: fix
errors") changed every terminate_process to take the process by value, but
left the two calls that mutate it:

    src/timeout/timeout_windows.c.v:13:3: error: `p` is immutable, declare it
        with `mut` to make it mutable
    src/timeout/timeout_windows.c.v:15:3: error: `p` is immutable, declare it
        with `mut` to make it mutable

    fn terminate_process(p os.Process, ...) {
        if sig_num == 15 { p.signal_term() } else { p.signal_kill() }
    }

Reproduced on c6cbc32: `v -o timeout.exe src/timeout` fails with exactly
those two errors, so the Windows build of timeout is broken on main. CI has
been failing inside the V bootstrap before it reaches any of this, which is
why it went unnoticed.

The comment already sitting above that function says why a value cannot
work - "A pointer, because signalling a process changes it. Passing it by
value ... made the compiler reference it for us and then reject that as
deprecated automatic referencing." - so the signature is what has to move
back, not the comment.

All three platform variants have to agree, because timeout.v calls whichever
one the target selects from a single shared call site. So all three take
`mut p &os.Process` and both call sites pass `mut &p`, which is what the tree
had before c6cbc32 and is the only combination of those two choices that
compiles.

Verified after the change: timeout builds, and src/timeout passes 1/1 with a
real GNU timeout on PATH to compare against. v fmt -verify is clean on all
four files. The diff is five lines - three signatures and two call sites.
@dy-tea
dy-tea merged commit a8b46d6 into vlang:main Oct 20, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants