On 2018-09-27 08:51 -0400, Greg Wooledge wrote: > On Wed, Sep 26, 2018 at 10:38:53PM +0000, Grzesiek Sójka wrote: >> Hi there, >> >> I compiled following test program: >> ========================================== >> #include <ncurses.h> >> #include <string.h> > [snip] > >> It's supposed to show current window dimension when resizing terminal >> window. Unfortunately, dimensions are not updated and it shows initial >> geometry. Interesting thing is that it works perfectly after "ssh localhost" >> or "su -". I tested on both, sid and stretch. exactly the same result. >> >> Any ideas?? > > My first thought is that your shell login profile, > >> PS. I use xfce4 and lxdm. > > ... which is NOT how you normally log in, is turning on bash's > checkwinsize option, which causes bash to set the LINES and COLUMNS > variables upon receipt of a SIGWINCH (a signal that is sent when the > window changes size). > > In the absence of that option, those variables might not be set at all, > or might be set to the wrong size, and won't be updated when the window > changes size while sitting in an idle shell. > > (What an ncurses program does with this signal, I honestly do not know.) > > So, just wild-ass guessing here, you might have put the necessaray > "shopt -s checkwinsize" and "export LINES COLUMNS" into ~/.profile > which is only read when you perform a shell login, and NOT when you > perform an lxdm login.
Actually it is exactly the other way around. If LINES and COLUMNS are set in the environment, then the ncurses library will _not_ update the screen size upon receiving SIGWINCH, and that causes the behavior Grzesiek observed. This is documented in ncurses(3). Cheers, Sven