You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] Interactive no-tty startup defaults: emacs editing mode off + H missing in $- for --rcfile/-s paths (kills ble.sh at its noediting gate; -i -c $- diverges the other way: hBc vs himBH) #312
Interactive-shell startup defaults diverge between rubash and GNU bash 5.3.0 when there is no tty on stdin (the normal shape for --rcfile harnesses, CI, and any scripted -i usage). Two independent divergences:
Editing mode: GNU keeps set -o emacs ON for -i shells regardless of stdin (readline only engages when a line is actually read); rubash leaves emacs/vi OFF in the -i <file>, -i -s, and -i --rcfile paths. (Note: GNU itself turns emacs OFF for plain -i <file> — the one shape where they match.)
$- flags: for -i --rcfile <rc> with stdin=/dev/null, GNU $-=himBH (H = history), rubash $-=himB. For -i -c the divergence is the reverse shape: GNU $-=hBc (no i/m/H), rubash $-=himBH.
Impact (ecosweep2 lane, A4 ble.sh full load): ble.sh aborts at ble.sh:598 ("ble.sh is not intended to be used with the line-editing mode disabled (--noediting)") because [[ ! -o emacs && ! -o vi ]] is true under rubash. With a real PTY GNU loads 1,902 functions (rc=0); rubash with the bleopt_connect_tty TTY-gate bypass gets 33 functions and aborts at the noediting gate. This is the current layer blocker for any PTY-less ble.sh / readline-replacement framework load.
Observed matrix (stdin = /dev/null unless noted)
invocation
GNU 5.3.0 $- / emacs
rubash @116b12aa $- / emacs
-i --rcfile rc
himBH / ON
himB / OFF
-i -s (stdin=pipe)
himBHs / ON
himBHs / OFF
-i file.sh
himBH / OFF
himBH / OFF (match)
-i -c '…'
hBc / ON
himBH / ON
-i --rcfile rc under real PTY (script)
himBH / ON
(n/a — no ConPTY harness; winpty rejects piped stdin)
GNU 5.2.21 cross-check agrees with 5.3.0 on the -i -c row (hBc).
GNU C source anchors (vendored third_party/bash)
shell.c:1830 init_interactive() — sets interactive/history defaults and does not set no_line_editing; only shell.c:1853 init_noninteractive() sets no_line_editing = 1. The emacs default for interactive shells comes from the absence of that flag plus shell.c option processing (-o emacs default when no -o vi).
History flag H in $-: variables.c/flags rendering from histexp_flag/history_expansion initialized in init_interactive() (shell.c:1830-1842).
Reproducers (script files, run both shells, stdin /dev/null)
Fixed by wt13/sweepfix (9e9b44bb, master 203c2b5): emacs had no default-on point and history/histexpand were set only after init files (rcfile $- missing H). apply_init_interactive_defaults now runs at the top of all three interactive init paths (before rcfiles): history/histexpand/emacs with --noediting (previously ignored, now wired) and -o vi guards; -i script path stays off. NOTE the lane CORRECTED the issue matrix: GNU -i -c is himBHc (verified on 5.3.0 and 5.2.21), the filed hBc row was a misprobe. Anchors: shell.c:540-549/1830-1870, builtins/set.def:446-449. ble.sh noediting gate passes.
Real bug found in triage and fixed as PR #697 (branch fix/rcfile-double-source): interactive shells sourced --rcfile twice. File 6/9->9/9; #297 semantics preserved. Gate running.
Follow-up: the remaining 3 (gate 6/9->9/9) were a real double-source bug — landed as #712 (squash-merged 29f1a28). rcfile now sourced once; non-interactive extension + #297 semantics preserved.
Activity
docs(corpus): ecosweep2 lane section — second-pass fine-grained corpu…
fix(#312): interactive no-tty defaults - init_interactive runs before…
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt13/sweepfix (9e9b44bb, master 203c2b5): emacs had no default-on point and history/histexpand were set only after init files (rcfile $- missing H). apply_init_interactive_defaults now runs at the top of all three interactive init paths (before rcfiles): history/histexpand/emacs with --noediting (previously ignored, now wired) and -o vi guards; -i script path stays off. NOTE the lane CORRECTED the issue matrix: GNU -i -c is himBHc (verified on 5.3.0 and 5.2.21), the filed hBc row was a misprobe. Anchors: shell.c:540-549/1830-1870, builtins/set.def:446-449. ble.sh noediting gate passes.
caomengxuan666 commentedon Oct 17, 2026
Real bug found in triage and fixed as PR #697 (branch
fix/rcfile-double-source): interactive shells sourced --rcfile twice. File 6/9->9/9; #297 semantics preserved. Gate running.caomengxuan666 commentedon Oct 17, 2026
Correction: the fix PR is #712, not #697.
fix(shell): source --rcfile once in interactive shells (#312) (#712)
caomengxuan666 commentedon Oct 17, 2026
Follow-up: the remaining 3 (gate 6/9->9/9) were a real double-source bug — landed as #712 (squash-merged 29f1a28). rcfile now sourced once; non-interactive extension + #297 semantics preserved.