Skip to content

fix(unix): discover the installed shell by platform binary name - #463

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/unix-shell-discovery
Oct 20, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/unix-shell-discovery

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Problem

find_installation_root and resolved_shell_path (crates/niubash-runtime/src/shell_links.rs) only looked for niu.exe next to a winuxcmd tree, so on Unix the installation root was never found and NIU_SHELL/WINUXSH_SHELL fell back to the invoked bash/sh face path.

Reproduced on Android/Termux (aarch64): host_contract::shell_faces_do_not_expose_product_verbs_and_name_the_real_shell failed with NIU_SHELL=.../bin/bash instead of the real shell.

Fix

  • SHELL_BIN_NAME: niu.exe on Windows, niu on Unix — installation discovery looks for what the platform actually ships.
  • SHELL_FACES: bash/sh on Unix instead of bash.exe/sh.exe, so --relink-shells generates usable faces there too.
  • Unit-test fixtures in shell_links.rs and one error string in main.rs updated to match.

Verification (Android/Termux, aarch64-linux)

  • cargo fmt --check -p niubash clean
  • cargo test --locked --test host_contract: 48 passed, 0 failed (was 47 passed / 1 failed)
  • shell_links unit tests: 3 pass; the other 2 need filesystem hardlinks, which this device sandbox denies (link() EPERM everywhere, same on the pre-change baseline) — they exercise link creation, untouched by this change.

No dependency or lockfile changes.

find_installation_root and resolved_shell_path only looked for
niu.exe next to a winuxcmd tree, so on Unix the installation root was
never found and NIU_SHELL fell back to the invoked bash/sh face path.
Look for niu on Unix (niu.exe on Windows) and generate bash/sh faces
instead of bash.exe/sh.exe there, so the NIU_SHELL contract names the
real shell on every platform (host_contract:
shell_faces_do_not_expose_product_verbs_and_name_the_real_shell).
@caomengxuan666
caomengxuan666 merged commit 221a23f into master Oct 20, 2026
10 of 11 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/unix-shell-discovery branch October 20, 2026 08:04
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.

1 participant