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 startup never initializes COLUMNS/LINES without a tty: GNU binds 80/24 via readline defaults — OMB iterate theme dies at $(($COLUMNS/1)) #300
GNU initializes COLUMNS/LINES to the readline screen-size defaults (80x24) during
interactive startup even when there is no controlling terminal; rubash leaves them unset,
so any $(($COLUMNS...))-style prompt code (the $-prefixed arithmetic form, which performs
parameter expansion before evaluation) breaks.
Real-world impact
oh-my-bash themes/iterate/iterate.theme.sh:47: [[ ${#new_PS1} -gt $(($COLUMNS/1)) ]] && wrap_char="\n" → /1: arithmetic syntax error on every prompt under rubash (PROMPT_COMMAND stderr noise;
PS1 falls back). The same theme run under GNU (LF OMB copy) is error-free
(target/issue-suites/results/ecosweep/probes/diag-it-gnu.err, 0 arithmetic errors).
GNU C anchor
lib/sh/winsize.c:100 calls sh_set_lines_and_columns(win.ws_row, win.ws_col)
(variables.c:1040, binds LINES then COLUMNS); when no winsize is available the readline
terminal setup binds the 80x24 defaults — lib/readline/terminal.c:374
(sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth)), reached during
interactive-shell readline initialization (shell.c:547 init_interactive).
Fixed by wt11/inter3 (cf39a2d4, master): COLUMNS/LINES now follow GNU's dual mechanism — get_tty_state at startup-job-control and post-rcfile points (jobs.c:4871 -> :2647 -> winsize.c:98-100; CONOUT$ screen-buffer visible rect = TIOCGWINSZ semantics) and _rl_get_screen_size at first prompt (terminal.c:293-374 via bashline.c:524: console -> positive-bound guard :640-643 -> env -> 80x24 default :366-371), bound as non-exported shell variables (variables.c:1040). Verified: DETACHED process PROMPT_COMMAND sees C=80/L=24 with clean arithmetic; console session sees real size; WSL harness's 1x1 console yields LINES=1 on GNU too (mechanism confirmed via gdb+strace). 10 new regressions.
Activity
fix(#297,#300): interactive init — rcfile exit terminates the shell; …
caomengxuan666 commentedon Sep 28, 2026
Fixed by wt11/inter3 (cf39a2d4, master): COLUMNS/LINES now follow GNU's dual mechanism — get_tty_state at startup-job-control and post-rcfile points (jobs.c:4871 -> :2647 -> winsize.c:98-100; CONOUT$ screen-buffer visible rect = TIOCGWINSZ semantics) and _rl_get_screen_size at first prompt (terminal.c:293-374 via bashline.c:524: console -> positive-bound guard :640-643 -> env -> 80x24 default :366-371), bound as non-exported shell variables (variables.c:1040). Verified: DETACHED process PROMPT_COMMAND sees C=80/L=24 with clean arithmetic; console session sees real size; WSL harness's 1x1 console yields LINES=1 on GNU too (mechanism confirmed via gdb+strace). 10 new regressions.