On Tue, May 12, 2026 at 10:07 AM Chet Ramey <[email protected]> wrote:
>
> On 5/11/26 4:06 PM, Zachary Santer wrote:
> >
> > Huh? Yeah, I would be one of those people.
>
> Oh, OK. I thought your proposal would have bash unset `checkwinsize' if
> it found LINES or COLUMNS in the initial environment.
>
> Since many (most) terminal emulators set LINES and COLUMNS in the
> environment they provide to the shell they invoke, and bash exports
> variables it finds in its environment, this would effectively disable
> any default that had it enabled.

I didn't know the initial values for LINES and COLUMNS were exported
from the terminal emulator.

However, 'declare -p LINES COLUMNS' in both
- bash 4.2.46(2)-release running in GNOME Terminal 3.28.2, and
- bash 5.2.37(1)-release running in mintty 3.7.8
shows those variables as not marked for export.

If they were always exported from the environment, then they'd at
least not be initially unset in a noninteractive shell, which would
help.

In the case that LINES or COLUMNS showing up in a script's environment
definitely indicates purposeful action by the script's user, disabling
checkwinsize automatically would make perfect sense. In the case of an
interactive shell receiving those variables from its environment, yes,
you would want to leave checkwinsize enabled.

> I did a quick survey, and all the terminal emulators on my macOS machine,
> and the default Terminal program on a Fedora VM, set LINES and COLUMNS
> for the shell when you open a new instance (I don't set them in my
> startup files). I don't know exactly how widespread this is, but it seems
> like it would create more problems, especially with the default having been
> the way it is for so long.

And you're sure that bash is then exporting those variables?

Reply via email to