[pacman-dev] -Qi output corrupted when using screen

Roman Kyrylych roman.kyrylych at gmail.com
Sun Feb 28 05:45:54 EST 2010


On Sun, Feb 28, 2010 at 12:31, Xavier Chantry <chantry.xavier at gmail.com> wrote:
> On Sun, Feb 28, 2010 at 10:24 AM, Roman Kyrylych
> <roman.kyrylych at gmail.com> wrote:
>> On Sat, Feb 27, 2010 at 23:35, Xavier Chantry <chantry.xavier at gmail.com> wrote:
>>>
>>> Well Jeff and I are still waiting for some feedback on our original questions..
>>
>> Sorry for the delay.
>>
>> On Fri, Feb 26, 2010 at 22:39, Jeff <jeff at kcaccess.com> wrote:
>>> Here is a simple POC to see what the output is. It calls ioctl twice
>>> with a 10 second delay for changing window sizes between calls. It
>>> doesn't use TIOCGSIZW as that is not defined in Linux, but rather BSD
>>> and maybe some others. I am not familiar with vps or linode.
>>
>> So, I get
>>  rows:    0
>>  columns: 0
>>  rows:    0
>>  columns: 0
>> instead of expected
>>  rows:    24
>>  columns: 80
>>  rows:    36
>>  columns: 139
>>
>
> So TIOCGWINSZ is defined, the ioctl call does not return any error,
> but it still just returns 0. Weird.
> By the way, how did you figure out the expected values ?

The "expected" are when executing Jeff's term_sz program
while logged in via ssh (2nd pair is after I resized the window).

> In git master, after the commit I linked above, with your bogus ioctl
> call, or piping to cat, getcols() returns 0, and the callers treat
> that as no linewrap.
> So that could be a problem for you. I wonder if we should keep the
> fallback to 80 columns in this bogus situation.
>
> Or maybe we could fallback to that old unused code :
> - /* Original envvar way - prone to display issues
> - const char *cenv = getenv("COLUMNS");
> - if(cenv != NULL) {
> - return atoi(cenv);
>
> I am curious to know if that's the only way that works for you.

Perhaps if win.ts_cols is 0 after ioctl it should assume 80
or use getenv (if that doesn't cause extra issues),
and to check if we are on a non-tty it should use isatty().

-- 
Roman Kyrylych (Роман Кирилич)


More information about the pacman-dev mailing list