Re: [doc] LINES/COLUMNS auto-update in non-interactive shells contradict
From:
Stan Marsh
Subject:
Re: [doc] LINES/COLUMNS auto-update in non-interactive shells contradicts ...
Date:
Sun, 10 May 2026 13:57:56 -0600
From: Ilya Tsoy
Subject: [doc] LINES/COLUMNS auto-update in non-interactive shells contradicts
manual
Date: Sun, 10 May 2026 09:13:10 +0000
>Description:
>The bash(1) manual states that LINES and COLUMNS are "automatically set
>... in an interactive shell upon receipt of a SIGWINCH". In practice,
>both variables are also updated in non-interactive shells whenever
>the shell evaluates a command that queries terminal geometry via
>ioctl(TIOCGWINSZ), because checkwinsize is enabled by default since
>bash 4.3 and applies regardless of interactive mode when a controlling
>TTY is present.
>This silently breaks scripts that use LINES or COLUMNS as user variables
>(e.g. as array names): the array is converted to a scalar and its
>[0] element is overwritten with the current terminal height/width.
>The behavior depends on whether the script's stdin is a TTY, making
>it irreproducible under ssh-without-tty or under cron, but reliably
>reproducible from an interactive login.
Very interesting. Kinda had to dig to find this one, didn't you?
But it is impressive, no doubt about that.
It sounds like a simpler fix is to declare that all-caps variable
names are reserved to the implementation. I think most people operate
under this assumption already.
=================================================================================
Please do not send me replies to my posts on the list.
I always read the replies via the web archive, so CC'ing to me is unnecessary.
[Prev in Thread]
Current Thread
[Next in Thread]
Re: [doc] LINES/COLUMNS auto-update in non-interactive shells contradicts ...,
Stan Marsh<=