Skip to content

WIP: audit family W — dead wiring (Refs #2575 #2576 #2577 #2578 #2579) - #2597

Merged
caomengxuan666 merged 9 commits into
masterfrom
fix/audit-family-w
Nov 2, 2026
Merged

caomengxuan666 merged 9 commits into
masterfrom
fix/audit-family-w

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Refs #2577
Refs #2578
Refs #2579
Refs #2575
Refs #2576

Family W (dead wiring) of the win-side audit batch — one commit per issue, in the briefed order. Handed in CODE-ONLY per the 2026-11-02 17:03 pace change: all stems below are UNVERIFIED-BY-CAPTAIN; the captain runs them centrally. (Worker-side tallies from before the pace change are in the family report, audit-line/REPORT-rubash-W.md, for reference only.)

Commits: 21d67ae (#2577), 4825bed (#2579), a7626e4 (#2578), 4f36701 (#2575), f9ac33d (#2576).

Captain verification queue — exact stems (ALL UNVERIFIED-BY-CAPTAIN)

Notes

failglob is a shopt option (GNU builtins/shopt.def:219 shopt_vars:
{ "failglob", &fail_glob_expansion, NULL }); shopt -s failglob writes
the SHOPT store, but the concurrent-pipeline admission probe
(parameter_errors.rs) and the direct-coproc planner
(compound_exec.rs) consulted the set -o store via
shell_option_enabled(..., "failglob") (__RUBASH_SETOPT_failglob,
which shopt never writes), so both always observed failglob as off.
Route both through crate::builtins::shopt::option_enabled, the
accessor glob.rs already used.

Sibling audit: every shell_option_enabled name in src/ was
enumerated; failglob was the only shopt-owned name read from the
set -o store (all other names are set -o options; literal
__RUBASH_SETOPT_* readers name posix/hashall/history/monitor/vi
only).

Pin: tests/issue2577_failglob_store_regressions.rs (2/2 via build
slot + scrubbed cargo). Guards: issue1540 (9/9), issue1469 (1/1).
GNU builtins/wait.def:134-136 maps -f to JWAIT_FORCE; jobs.c
wait_for_job:3423 and wait_for_single_pid:2764 then loop until the
job is JDEAD / the child is not alive instead of returning at the
first state change. rubash parsed -f in all three scanners and
dropped it ('f' => {}), so wait on a stopped job returned
128+stopsig immediately even with -f.

wait_for_background_pid gains a force parameter: with force, the
recorded-Stopped short-circuit is skipped and the existing poll
loop blocks on the child handle until actual termination (a
stopped child's try_wait keeps returning None). Threaded through
the bare wait (including 'wait -f' with no operands), the
single-operand paths, wait_for_background_operands, and
WaitAnyRequest; all non-wait callers pass false.

Honest subset: the background path polls std Child handles (no
WUNTRACED waitpid, #2398), so force is honored for every state the
job table can observe; GNU's one-time internal_warning on the -f
path is not emitted. Oracle-probed (set -m): plain wait on a
SIGSTOPped job = 147, wait -f through CONT+TERM = 143.

Pin: tests/issue2579_wait_force_regressions.rs (4/4 via build slot
+ scrubbed cargo). Guards: issue1118 (1/1), issue1156 (2/2),
issue2340 (8/9; the one failure, main_shell_jobs_prints_survivor_once,
flakes identically on unmodified base 6529118: 2/4 failed there,
pass/fail/pass on this tree — pre-existing flake, not this change).
COMP_WORDBREAKS was bound invisible at startup (init.rs) with zero
consumers: split_for_completion split on whitespace only, so
'foo a=b<TAB>' completed the whole 'a=b' as one word and -F
functions saw a COMP_WORDS list GNU never produces.

GNU: bashline.c:313 bash_completer_word_break_characters (the
COMP_WORDBREAKS value) delimits the completion word, and
pcomplete.c bind_compfunc_variables exposes exactly that split as
COMP_WORDS/COMP_CWORD. Oracle PTY probes (GNU bash 5.3.20):
'foo a=b' -> [foo a = b] C=3 cur=b; 'foo a==b' -> [foo a == b]
(a maximal break RUN is one word); 'foo a=' -> [foo a =] cur==;
'foo a ' -> [foo a ""] cur=.

split_for_completion now takes the live COMP_WORDBREAKS
(comp_wordbreaks(): the bound variable, GNU default as fallback)
and tokenizes accordingly: whitespace only separates, break runs
are words of their own. Both consumers feed it: the complete_line
pipeline (complete.rs) and completion_dynamic_for_line's
COMP_WORDS binding (job_builtins.rs). The diff is confined to the
splitter and its two call sites, away from the compspec-fallback
region (#2570's territory).

Pin: tests/issue2578_comp_wordbreaks_regressions.rs (6/6 via build
slot + scrubbed cargo). Guards: issue1086 (2/2), issue1087 (1/1),
issue1088 (1/1), issue1089 (3/3), issue803 (2/2), lib unit tests
for complete/shopt/bind modules (49 passed).
bind 'set completion-ignore-case on' and friends were stored in
the bind registry and reported by bind -v, but the engine pipeline
could not see the registry: complete_line_candidates_with_dynamic
filtered with starts_with (case-sensitive) and path completion
listed dotfiles unconditionally.

GNU (lib/readline/complete.c): complete_fncmp :2428-2457 folds
case under _rl_completion_case_fold and treats '-'/'_' as
equivalent under _rl_completion_case_map; :2630-2640 skips hidden
files under _rl_match_hidden_files == 0 only when the typed
filename part is empty; disable-completion removes the attempt.

ReadlineCompletionSettings is snapshotted from the bind registry
(BindRegistry::variable_value) in Executor::complete_line and
threaded through complete_line_candidates_with_dynamic into the
prefix filter (completion_candidate_matches_word) and, via
apply_completion_actions_with_settings, into
path_completion_candidates' hidden-file rule. Implemented:
completion-ignore-case, completion-map-case, match-hidden-files,
disable-completion. compgen keeps default settings (pcomplete.c's
static generators compare with STREQN, not complete_fncmp).

Residuals: expand-tilde not wired (the shared generator's
unconditional ~/ expansion is the pinned compgen contract #523;
splitting the paths needs a dedicated PTY probe cycle). Host-tier
variables (mark-directories, visible-stats, show-all-if-*,
completion-query-items, ...) shape host display, not the engine
candidate set.

Pin: tests/issue2575_readline_vars_regressions.rs (4/4 via build
slot + scrubbed cargo).

Note: Executor::complete_line's progcomp gate for the dynamic
hooks (bashline.c:1681, #2576) shares the edited hunk in
public_accessors.rs and lands in this commit; #2576's own commit
carries the static-side progcomp gate, restricted_shell,
no_empty_cmd_completion and FIGNORE.
… FIGNORE

Dead shopt options, implemented per GNU source (the full
per-option audit table is in the family report):

- progcomp (bashline.c:1681 prog_completion_enabled gates the
  programmable-completion attempt): complete_line_candidates_
  with_dynamic resolves no compspec when off. The dynamic-hook
  half of the gate in Executor::complete_line landed with the
  #2575 threading commit (shared hunk, noted there).
- restricted_shell (builtins/shopt.def:750-757
  set_restricted_shell): option_enabled now derives the value
  from the invocation 'restricted' state and set_option forces
  any shopt write back to it (status stays 0), so
  shopt/BASHOPTS never report a state that is not in effect —
  and do report it under -r/rbash.
- no_empty_cmd_completion (bashline.c:1879-1884): an empty
  command word with no governing compspec yields no candidates.
- force_fignore + FIGNORE (bashline.c:3065-3091
  filename_completion_ignore): FIGNORE suffixes are excluded in
  the complete_line pipeline; the exclusion may empty the list
  only under force_fignore (default on). Oracle proved compgen
  does NOT apply FIGNORE (FIGNORE=.o compgen -A file lists .o
  files), so the shared generators are untouched.

Left stored and documented as stubs in the report (no honest
consumer exists engine-side, or GNU itself does nothing):
hostcomplete, progcomp_alias (owned by #2574's retry layer),
complete_fullquote, cdspell/dirspell/direxpand (host/display),
mailwarn, histreedit/histverify (host line editor), extquote,
noexpand_translation, globasciiranges (parser/glob audits),
set -o notify/onecmd/privileged (invocation/prompt-cycle),
nolog (dead upstream too). No set-time rejections were invented:
GNU stores all of these too.

Pin: tests/issue2576_dead_shopt_regressions.rs (6/6 via build
slot + scrubbed cargo). Guards: issue1487 (1/1).
…te helpers (captain integration)

The #2575 settings threading changed path_completion_candidates to take
&ReadlineCompletionSettings, but the #2594 fallback helpers
(directory_candidates_matching / filename_candidates_matching) predated
the merge point and kept the old arity, so the combined tree did not
compile. Per the #2575 design (apply_completion_actions_with_settings:
the line path threads the live readline settings; pcomplete.c's static
generators behind the compgen builtin compare with defaults), the line
completion callers now pass the live settings and the compgen-builtin
callers pass ReadlineCompletionSettings::default(). No behavior change
beyond the settings the fallback listings now honor on the line path
(hidden-file suppression inside path_completion_candidates).
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 2, 2026 11:39
caomengxuan666 and others added 3 commits November 2, 2026 19:39
…>> against its Option<i32> signature (E0308 on cross-target test compiles; the stem never compiled, so it never ran)
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