Skip to content

fix(invocation): separate restricted entry flags from named options (#626) - #628

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/issue-626-library-restricted
Oct 15, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/issue-626-library-restricted

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

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

  • Direct library regression target: 8 passed (independently rerun by coordinator).
  • Invocation unit tests: 9 passed; issue527 restricted entry tests: 5 passed (worker evidence).
  • Format/diff checks passed.

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.

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
caomengxuan666 merged commit 7107279 into master Oct 15, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/issue-626-library-restricted branch October 16, 2026 00:44
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
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.

[restricted] 库入口 ShellInvocation 仍硬拒 -r/--restricted(rc2 "invalid shell option name";#527/#560 未覆盖嵌入路径)(P2)

1 participant