Repository navigation
feat(native_path): resolve the shell tree in API operands (niubash #346) - #1185
Merged
Merged
Conversation
niubash #346: the bundled coreutils receive the shell's POSIX spellings verbatim, so normalize_api_operand_w now resolves the shell tree the same way rubash's shell_path_to_windows does — the bare "/" and every path below the configured install root, /tmp, /var/tmp, /home and the /mnt/X WSL drive form — and canonicalize_path_w re-expresses a shell-namespaced operand's result in the POSIX face, so readlink -f and realpath agree with the spelling-preserving pwd. The layer also applies the MSYS open order for executable leaves: an existing as-spelled path wins, else the X.exe sibling resolves the bare spelling (rubash#177), so `test -f /usr/bin/seq` and `head -1 /usr/bin/seq` agree while `ls -d` keeps the operand spelling. The mapping is inert unless a shell root is configured (the gate the bare "/" case already used), so standalone WinuxCmd keeps its native dialect and a foreign POSIX runtime is unaffected.
This was referenced Oct 16, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
niubash #346. The bundled coreutils receive the shell's POSIX spellings verbatim, so WinuxCmd now owns the shell namespace instead of leaning on rubash's pre-translation:
normalize_api_operand_wresolves the bare/and every path below the configured install root, plus/tmp,/var/tmp,/homeand the/mnt/XWSL drive form (shell_tree_to_native_w).canonicalize_path_wre-expresses a shell-namespaced operand's result in the POSIX face (shell_tree_display_w), soreadlink -fandrealpathagree with the spelling-preservingpwd.X.exesibling) keepstest -f /usr/bin/seqandhead -1 /usr/bin/seqconsistent whilels -dkeeps the operand spelling (rubash#177).The mapping mirrors rubash's
shell_path_to_windowsexactly:/tmp->TMPDIRelse%TEMP%;/var/tmp-><temp>/var/tmp;/home-> the parent ofHOME/USERPROFILE;/mnt/X->X:\.Scope / safety
The layer is inert unless a shell root is configured (
__RUBASH_SHELL_ROOT/NIU_ROOT/WINUXSH_ROOT/RUBASH_ROOT) — the same gate the bare/case already used — so standalone WinuxCmd keeps its native dialect and a foreign POSIX runtime is unaffected.Verification
Standalone (shell root configured, invoked directly without a shell):
ls -d / /usr/bin /etc /tmp /home /bin /mnt/drenders the POSIX spellings;ls /etcenumerates the shell tree;realpath /usr/bin,readlink -f /etc,realpath /tmpre-express;ls -d /usr/bin/seqresolvesseq.exeyet prints/usr/bin/seq;realpath .,ls -d C:/Windows) stay native.Refs unixwin/niubash#346.