Repository navigation
fix(winuxcmd): activation compares link identity, not existence - #401
Conversation
`has_required_command_links` only asked whether `ls.exe`, `cat.exe`, `grep.exe` and `ln.exe` exist, so a command link left on the *previous* winuxcmd.exe by an update satisfied it forever: activation then skipped the rebuild and that one command kept running an older build (observed as a stale `usr\bin\yes.exe` hours after the update - unixwin/WinuxCmd#1206). Compare identity instead: a required name must be the same file as this installation's `winuxcmd.exe`. When it is not, activation runs `wpm links rebuild --force` as before, which now also *names* the links it cannot replace (unixwin/WinuxCmd#1209). A stale name therefore heals on the next shell start instead of waiting for someone to notice. Test updated to match the contract it is asserting: names that are not links to the engine do not count, links to it do, and one name left on a different image is enough to ask for a rebuild.
d888dfd to
1c33c1c
Compare
|
CI red-diagnosis and fix note (rebased to master Red cause — all 3 failing checks shared one root cause, none of them in this PR's code. Classification: upstream dependency compile error, not a product regression and not a lane-environment issue. The cross-target lanes clone rubash HEAD fresh each run ( Fix: no source change was needed in this branch. Rebased onto current master ( |
… contract rubash#759 item 4 removed the zsh setopt/unsetopt aliases (rubash master c6f4a9b3, docs/builtins.md now lists 62 builtins), so the CI lane that clones rubash HEAD failed rubash_setopt_is_visible_when_sourcing_startup_rc with 'setopt: command not found' (exit 127). The pinned contract itself -- option builtins are visible while the startup rc is sourced and their state survives into the live shell -- is unchanged; re-point it at the bash-aligned shopt builtin: -s batch form, -u, and the bare state listing, with extglob/expand_aliases proving an actual off->on transition and dotglob covering the set-then-unset path.
The completion builtin inventory is delegated live from
Executor::builtin_command_names(), which no longer carries setopt/unsetopt,
so test_get_builtin_commands failed on 'assertion failed:
commands.contains("setopt")' as soon as CI cloned rubash master c6f4a9b3.
Pin the new shape: shopt present, the zsh aliases absent. The empty-Tab
suggestion lists keep suggesting a name that cannot resolve otherwise, so
they swap setopt -> shopt and drop unsetopt for the same reason.
Same root as the host-contract setopt rewrite: rubash#759 item 4 removed
the zsh-compatible aliases from the engine's public builtin surface.
Closes the self-healing half of #1206 (the WinuxCmd side is #1209).
Why
has_required_command_linksasked only whether four names exist:So a command link left on the previous
winuxcmd.exeby an update satisfied it forever: activation skipped the rebuild, and that one command kept running an older build. That is exactly the live finding in #1206 —usr\bin\yes.exeon the 1.1.12 image while the rest of the family was on 1.1.13, hours after the update, with nothing reporting it.What changes
A required name must now be the same file as this installation's
winuxcmd.exe. When it is not, activation runswpm links rebuild --forceexactly as before — and that path now names any link it cannot replace (WinuxCmd#1209). A stale name heals on the next shell start rather than waiting for someone to look.The identity helper is the one the shell-link work already uses (
shell_links::same_file), nowpub(crate), so there is one definition of "same file" on Windows (volume serial + file index) instead of a second copy.Verification
command_links_are_required_before_skipping_activationnow asserts the contract it is named for: names that are not links to the engine do not count, links to it do, and one name left on a different image is enough to ask for a rebuild.cargo test -p niubash-runtime→ 23 passed inwinuxcmd::tests+shell_links::tests(515 filtered);cargo check --tests --target x86_64-unknown-linux-gnuclean (the cross-target job compiles this code on unix hosts).Not here
wpm links rebuildstill does not refresh package shims (only the applet names); that belongs with #1207.CI red-fix log (2026-10-18)
The three failing cross-target checks and the later
build-and-testred were both moving-dependency fallouts, not product regressions in this branch; fixed on this branch in1c33c1c(rebase) +f724aae(test rewrite).cross-target-check(musl, ohos) +cross-target-smoke— upstream rubash compile error. The Oct 17 run cloned rubash HEAD before8d8537c6("allow the musl/ohoslibc::time_tdeprecation", rubash#782), and withsetup-rust-toolchain's-D warningsthe deprecation inprintf/zone.rs:367was a hard error on the musl-based targets (android/bionic and glibc hosts never see it). Fix: rebased onto masterd60276eso CI clones the fixed rubash; no source change needed here. All three lanes went green on the next run.build-and-testafter the rebase — expired test. rubash#759 item 4 (rubash masterc6f4a9b3, landed between master's last green run and our re-run) deliberately removed the zshsetopt/unsetoptaliases (docs/builtins.md: 64 → 62 builtins), sorubash_setopt_is_visible_when_sourcing_startup_rcfailed withsetopt: command not found(exit 127). The pinned contract — option builtins are visible while the startup rc is sourced and their state survives into the live shell — is unchanged, sof724aaere-points the test at the bash-alignedshoptsurface:-sbatch form,-u, and the bare state listing, with default-offextglob/expand_aliasesproving a real off→on transition and a set-then-unsetdotglobcovering-u.cargo test --test host_contract→ 48 passed locally.build-and-testsecond round — same contract change, third surface. rubash#759 item 4 also shrank the live builtin inventory thatCommandCompleter::get_builtin_commands()delegates to, sotest_get_builtin_commandsfailed oncommands.contains("setopt").8dc298fpins the new shape (shoptpresent, the zsh aliases absent) and swaps the empty-Tab suggestion entriessetopt->shopt/ dropsunsetopt, so Tab no longer offers a name that cannot resolve. (syntax_highlightingstill lists the alias words cosmetically; left alone on purpose.)No
release.ymlsemantics and no GPL-licensed material are touched; the branch diff is the one source commit of this PR plus the two rubash#759 catch-ups above.