[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Troublesome checkwinsize (none) behaviour

From: Chet Ramey
Subject: Re: Troublesome checkwinsize (none) behaviour
Date: Fri, 12 Jul 2013 07:40:00 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 7/12/13 5:57 AM, address@hidden wrote:

> Bash Version: 4.2
> Patch Level: 42
> Release Status: release
> Description:
>       As subject says:
>         * If checkwinsize is _not_ set the bash does not update the
>           internal LINES and COLUMNS varaible during a command/job is
>           running in foreground on same terminal.
>         * If checkwinsize is set bash/libreadline does export LINES and
>           COLUMNS breaking ncurses/TIOCGWINSZ based commands/jobs.
>       both cause bug reports here. That is if I override the default and
>       set the check_window_size to 1 in jobs.c I'll beaten by bug reports
>       and upstream (compare e.g. with
>       https://bugzilla.novell.com/show_bug.cgi?id=793536).
>       If I do not change the upstream behaviour I'll also beaten by bug
>       reports because know bash does not know about size changes during
>       an other job is in foreground
>       (compare e.g. with https://bugzilla.novell.com/show_bug.cgi?id=828877)
> Fix:
>       The bash/libreadline may (IMHO) update LINES and COLUMNS after a job
>       without exporting LINES and COLUMNS.  Simply to have a correct command
>       line behaviour of the bash its self after jobs had finished as well
>       as for the jobs them self to not to depend on static LINES and COLUMNS
>       but on TIOCGWINSZ only.

Bash does not export LINES or COLUMNS.  You can test this yourself by

1. Make sure that LINES and COLUMNS are not exported.  They're not on my
   Mac OS X or RHEL systems, for instance
2. Make sure the checkwinsize option is enabled
3. Run sleep 10 and resize the terminal
4. echo $LINES and $COLUMNS and see they've been updated
5. Look at the output of export and note that LINES and COLUMNS are still
   not exported

This is the output of those commands on an RHEL system:

$ export | grep LINES
$ export | grep COLUMNS
30 80
$ shopt -s checkwinsize
$ sleep 10
36 100
$ export | grep LINES
$ export | grep COLUMNS

Your analysis in bug 793536 is incomplete.  Had you looked further, you
would have discovered that the setenv calls in lib/readline/shell.c appear
in a function (sh_set_lines_and_columns) that is superseded by a bash
definition in variables.c.

I would look further at whether or not (and where) COLUMNS is being

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]