Htop: version 2.1.0 does not run in a small terminal

Created on 8 Feb 2018  路  5Comments  路  Source: hishamhm/htop

I use i3-wm on Arch and I like to run htop in a small terminal in the lower right corner of my screen. This worked fine up until I updated to version 2.1.0, since then if the terminal window is too small htop will not launch.

[danthem@machine ~]$ htop
htop: Success 

making the window bigger allows htop to run but I'd like to know if this was an intended change or a bug? I'd rather keep the window small.

Terminal is urxvt v9.22.

Most helpful comment

The problem lies here:
https://github.com/hishamhm/htop/blob/f37a050d3d0c6928b09d9b19e1283a695c52ccc7/Meter.c#L290
reverting this line to:
snprintf(bar, w + 1, "%*s", w, buffer);
allows htop to run in a small terminal again.

All 5 comments

Attaching a screenshot from a VM:
image

Note how htop only runs in the large terminal.

How small for the terminal window will htop exit as you described? Note that exiting with errno equals Success is definitely a bug. We just want you to help us track which change caused it (in case you know how to use git bisect to narrow down the changes).

Downstream bug report at Debian BTS: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=889693
Reproducible in plain xterm (Debian Stretch).

@Explorer09
Looks like it's mostly about the width of the window rather than the height.

This window is too small and results in the strange Success-exit:

[danthem@machine ~]$ htop
htop: Success
[danthem@machine ~]$ stty size
10 38
[danthem@machine ~]$ xwininfo -id 0xe0000a
[...]
Width: 391
Height: 201
[...]

However it runs fine at:

[danthem@machine ~]$ stty size
10 40
[danthem@machine ~]$ xwininfo -id 0xe0000a
[...]
Width: 404
Height: 201
[...]

The problem lies here:
https://github.com/hishamhm/htop/blob/f37a050d3d0c6928b09d9b19e1283a695c52ccc7/Meter.c#L290
reverting this line to:
snprintf(bar, w + 1, "%*s", w, buffer);
allows htop to run in a small terminal again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

svenha picture svenha  路  5Comments

mmarzantowicz picture mmarzantowicz  路  3Comments

kcgthb picture kcgthb  路  8Comments

RomainFranceschini picture RomainFranceschini  路  8Comments

grantwwu picture grantwwu  路  3Comments