Repository navigation
fix(invocation): separate restricted entry flags from named options (#626) - #628
Merged
Merged
Conversation
GNU flags.c:182 flag table, flags.c:226 change_flag and shell.c:679-744 main own restriction parsing and deferred startup activation. Refs #626; downstream host integration remains required.
caomengxuan666
added a commit
that referenced
this pull request
Oct 29, 2026
WIP: special-paths: publish the registry consumer face for niu S5 (niubash#627/#628)
SpookyWaste
pushed a commit
to SpookyWaste/rubash
that referenced
this pull request
Oct 29, 2026
…5 faces Enabler for niubash#627/unixwin#628 (vfs audit slice S5: completion and highlighting ask the special-path registry). No semantic change — the classification judgments are byte-identical; this only makes the registry reachable from outside the crate and adds the two enumeration faces its consumers need. - special_paths: the classification enum/function and the per-class queries become pub (the module was already pub mod; every item was pub(crate), so the host could not ask the registry at all). canonical_fd_number stays internal. - special_dev_entries(): the listable children of the shell-namespace /dev — leaf device/alias names plus the fd/tcp/udp prefix dirs. A two-way consistency pin (special_dev_entries_match_classification) proves the table against the classification over the audit's /dev vocabulary, so a future registry arm trips the pin until the table follows in the same change. Spellings the registry does not classify (/dev/zero, /dev/full, /dev/tty — audit D5) are deliberately not listed: the open points treat them as plain filesystem paths. - Executor::open_fds(): the session's open fd numbers from the fd table — the dynamic /dev/fd completion tier's source (audit §6.4: the fd table itself, never a name list). Pinned end-to-end in tests/session_api.rs: a fresh session holds [0, 1, 2], `exec 3>/dev/null` adds 3, `exec 3>&-` removes it. Refs unixwin/niubash#627 Refs unixwin/niubash#628
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.
Root cause
ShellInvocation routed -r/--restricted through named set -o validation, rejecting restricted shell entry with rc=2.
Fix
Keep restriction as dedicated invocation state; preserve rejection of -o restricted and cancellation via +r. Add apply_to_executor_before_startup / finish_startup so hosts can follow GNU startup timing. Existing apply_to_executor remains immediate convenience for startup-free callers.
GNU source ownership: flags.c:182 flag table, flags.c:226 change_flag, shell.c:679-744 main and shell.c:1278 maybe_make_restricted. Agent recorded WSL GNU Bash 5.3.0 script-file oracle evidence in docs/issue626-restricted-invocation.md.
Verification
Integration boundary
Niubash must migrate its startup paths to the two-phase API before this is considered end-to-end complete. Host integration is assigned separately; do not close #626 on this library change alone.
Refs #626.