libstore: say what actually blocks SSH on Windows - #16382
Conversation
The TODOs on these three guards said "once we can fork". As xokdvium pointed out on NixOS#16347, that reads as a TODO on an impossible precondition: Windows is not going to gain fork. The blocker is fork-shaped, though, so reverting to the previous "once we can start processes" would be stale in the other direction now that NixOS#16347 made Pid and ordinary process spawning work. What these sites actually need is startProcess(fun<void()>), which is declared inside #ifndef _WIN32 and runs its callback in the forked child -- that is where startCommand does its dup2s over stdin, stdout and stderr, and CreateProcess has no equivalent step. So name the missing primitive instead. The UnimplementedError on the Windows branch gets the same treatment; it still claimed "because spawning processes is not yet implemented", which is no longer the reason. Comments and one error message only; no behaviour change. Assisted-by: Claude Code (claude-opus-5)
|
I would like to be even clear. We The TODO can still be short though, e.g. "reimplement launching without |
|
Agreed, and that's a better framing than mine — "needs One check before I push, since you wrote #ifndef _WIN32 // TODO reimplement launching without startProcess(), so it doesn't require fork.The other question is the |
|
Alternatively, let's just wait for spawnProgram changes that would come anyway? Most of this would become a runProgram2 split into spawnProgram which returns a Pid and supports standard stream redirects. I do have some stuff for that cooking. |
|
I checked whether that would actually subsume these sites rather than guess, and it would — both of them. Enumerating everything the two
No Two things
There is one mechanical consequence rather than an obstacle: On whether to land this PR versus wait for your split: that is genuinely your and @Ericson2314's call, and |
|
@awsmadi Honestly if you thought that must about it, you should just make it work with |
|
Measured before assuming: So this can't be built on @xokdvium, could you publish that branch, even as a draft? That would give this something concrete to target. Closing the loop on the earlier question while I'm here: the function all three sites go through is |
|
Correction to my previous comment, and it sharpens the blocker rather than softening it. I said The blocker survives the correction, for two specific reasons:
I had already worked this out and then contradicted myself, which is the annoying part: the So the open question is unchanged but better grounded: exporting |
ad2d040 to
eb93540
Compare
Follow-up to a review comment on the merged #16347: xokdvium
pointed out that the TODOs there now read
"once we can fork", which is a precondition Windows is never going to meet.
He's right about the wording. Reverting to the previous "once we can start processes" would be stale in the
other direction, though, because #16347 is what made
Pidand ordinary process spawning work on Windows.What these three sites actually need is
startProcess(fun<void()>), declared inside#ifndef _WIN32atprocesses.hh:128, which runs its callback in the forked child — that is wherestartCommanddoes itsdup2s over stdin, stdout and stderr, andCreateProcesshas no equivalent step.So this names the missing primitive rather than reverting. The
UnimplementedErroron the Windows branchgets the same treatment, since it still claimed "because spawning processes is not yet implemented", which
is no longer the reason.
Comments and one error message; no behaviour change. Verified
nix build .#checks.x86_64-linux.pre-commit(7/7 hooks) and that
nix-store-x86_64-w64-mingw32still compiles, since the changed error message sits inan
#ifdef _WIN32branch that a native build never sees.