Repository navigation
Description
What we see
After wpm update winuxcmd, a command link can be left on the previous winuxcmd.exe while the rest of the family is refreshed, and nothing reports it. Observed on a live install:
usr\bin\yes.exe size 4,115,456 (the 1.1.12 image, mtime 2026-10-16 18:30)
usr\bin\winuxcmd.exe size 4,119,040 (1.1.13)
The rest of the 178-name link family was on the current inode; only yes.exe had been left behind, hours after the update. wpm links rebuild --force repaired it in one pass (created=1 unchanged=177), so the link set itself is fine — it is the update path that leaves a name stale, silently.
Why it is invisible today
apply_update()ends withrebuild_links(root, true, …)and returns its exit code, but the helper is launched detached (launch_apply_update→CreateProcessW(..., CREATE_NO_WINDOW, ...)) and its stdout/stderr are discarded — a failure inside the update produces no visible output anywhere.rebuild_linkscounts failures (links created=… unchanged=… failed=…) but never names the link that failed, so even a visible run cannot say which command is stale.auto_activate_bundled_winuxcmd(the check that would repair it on the next shell start) only verifies that a few required links exist — it does not compare identity — so one stale name never triggers the rebuild.
Reproducing it is a trap in itself
wpm update winuxcmd returns before the swap happens: the helper waits for the updating process to exit (WaitForSingleObject(parent, 30000)) and only then replaces the image and relinks. Auditing the link set immediately after the command returns shows the whole family as "stale", which is a false positive — I chased that for a while. Anything that verifies an update must either wait for the helper or check wpm version / the file identity again later. Worth saying in the guide.
Suggested fixes (in the order they pay off)
- Give the helper a log. Write its output to
<root>\.wpm\logs\self-update.log(rotating, one file). Without this, every failure in this path is unobservable. - Name the failing link and park instead of giving up. The
remove_link_if_saferefusal path currently just incrementsfailed; parking the name aside and linking over it (what package upgrades already do since fix(wpm): replace held payload files by parking them, not by refusing #1194) lets the update complete, and printing the name makes the residual failure actionable. (Patch in flight.) - Verify after the swap. After
rebuild_links, re-read the family and re-run once if any name still points at another inode; report the names if the second pass fails. - Strengthen the activation spot-check (
has_required_command_links) to compare file identity for a sample instead of testing existence, so a stale family self-heals on the next shell start rather than waiting for a manuallinks rebuild.
Acceptance
- An update that cannot relink a name leaves a log line naming it, and the install reports the mixed state instead of exiting 0 silently.
- After an update (waiting for the helper), every name in
usr/binthat is a link towinuxcmd.exeshares its inode, verified by a test that stops a name from being replaced.
Activity
fix(wpm): log the self-update helper, verify the links after the swap…
Merge pull request #1226 from unixwin/fix/wpm-lifecycle-acceptance-tests
fix(winuxcmd): activation compares link identity, not existence