Bug#793106: htop: malfunctions with TERM=linux-16color [was: Some processes running seem to be ‘hidden’ (i.e not showing - except when highlighted)]

2017-01-24 Thread Ben Longbons
The problem is that TERM=linux-16color is the terminfo entry that is
correct. TERM=linux is the buggy entry, and htop is buggy for using
"bold" when it means "bright".

(I can speak with confidence that I am one of only a few dozen, or
maybe a few hundred, people in the world who understands virtual
terminals at the lowest level. Htop is clearly doing the Wrong Thing™,
using behavior that became obsolete before the Linux kernel even
*existed*. There is absolutely *no* excuse for programs written since
1991 to use it.)

You're doing *something* wrong, since the kernel's terminal emulator
doesn't support underlining. You *must* use ctrl-alt-F1 and reproduce
there.

Also, in order to have the problem in the first place in htop, you
have to have htop's option set, in setup -> display options -> shadow
other user's processes

On Mon, Jan 23, 2017 at 11:30 PM, Daniel Lange  wrote:
> Control: severity -1 minor
> Control: tags -1 moreinfo
>
> TERM=xterm-256color htop # works in xterm from Jessie. No issues.
> TERM=linux-16color htop # works, looks ugly (underlines)
>
> So this all works as intended. Obviously a bad choice of terminal
> emulation will lead to ugly rendering. I *assume* the original reporter
> also had a weird combination of the TERM variable and terminal
> application and that led to only highlighted lines rendering readably.
>
> It is not possible for htop to render correctly in all cases where
> people have broken terminfo, esp. people sshing from Macs etc.
>



Bug#793106: htop: malfunctions with TERM=linux-16color [was: Some processes running seem to be ‘hidden’ (i.e not showing - except when highlighted)]

2017-01-23 Thread Daniel Lange
Control: severity -1 minor
Control: tags -1 moreinfo

TERM=xterm-256color htop # works in xterm from Jessie. No issues.
TERM=linux-16color htop # works, looks ugly (underlines)

So this all works as intended. Obviously a bad choice of terminal
emulation will lead to ugly rendering. I *assume* the original reporter
also had a weird combination of the TERM variable and terminal
application and that led to only highlighted lines rendering readably.

It is not possible for htop to render correctly in all cases where
people have broken terminfo, esp. people sshing from Macs etc.



Bug#793106: htop: malfunctions with TERM=linux-16color [was: Some processes running seem to be ‘hidden’ (i.e not showing - except when highlighted)]

2017-01-23 Thread Ben Longbons
FYI, your mailer config is broken, so you're being classified as spam.
Please read https://support.google.com/mail/answer/81126?hl=en#authentication

On Wed, Jan 11, 2017 at 12:57 PM, Daniel Lange  wrote:
> How can I reproduce the issue on Debian Linux?

Pretty much anybody who *ever* edits their ~/.bashrc adds something like:

case $TERM in
xterm) TERM=xterm-256color;;
esac

I just added a second case for linux.



Bug#793106: htop: malfunctions with TERM=linux-16color [was: Some processes running seem to be ‘hidden’ (i.e not showing - except when highlighted)]

2017-01-11 Thread Daniel Lange
Thank you very much for the detailed analysis.

> I just hit this myself, and narrowed down the cause to running with
> TERM=linux-16color.

How can I reproduce the issue on Debian Linux?



Bug#793106: htop: malfunctions with TERM=linux-16color [was: Some processes running seem to be ‘hidden’ (i.e not showing - except when highlighted)]

2017-01-11 Thread Ben Longbons
Package: htop
Version: 2.0.2-1
Followup-For: Bug #793106

Dear Maintainer,

I just hit this myself, and narrowed down the cause to running with
TERM=linux-16color.

$ infocmp linux linux-16color

comparing linux to linux-16color.
comparing booleans.
comparing numbers.
colors: 8, 16.
ncv: 18, 42.
pairs: 64, 256.
comparing strings.
setab: '\E[4%p1%dm', '\E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m'.
setaf: '\E[3%p1%dm', '\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m'.

In particular, `ncv` for linux-16color includes `A_BOLD` and `A_BLINK`.
(It is, buggily, missing `A_DIM` since the termianal includes the `dim`
capability, but it correctly lacks `A_ITALIC` since it doesn't have `stitm`).

From terminfo(5):

   On some color terminals, colors collide with highlights.  You can  reg‐
   ister  these collisions with the ncv capability.  This is a bit-mask of
   attributes not to be used when colors are enabled.  The  correspondence
   with the attributes understood by curses is as follows:

Attribute  Bit   Decimal  Set by
A_STANDOUT 0 1sgr
A_UNDERLINE1 2sgr
A_REVERSE  2 4sgr
A_BLINK3 8sgr
A_DIM  4 16   sgr
A_BOLD 5 32   sgr
A_INVIS6 64   sgr
A_PROTECT  7 128  sgr
A_ALTCHARSET   8 256  sgr
A_HORIZONTAL   9 512  sgr1
A_LEFT 101024 sgr1
A_LOW  112048 sgr1
A_RIGHT124096 sgr1
A_TOP  138192 sgr1
A_VERTICAL 1416384sgr1
A_ITALIC   1532768sitm

   For  example, on many IBM PC consoles, the underline attribute collides
   with the foreground color blue and is  not  available  in  color  mode.
   These should have an ncv capability of 2.

   SVr4  curses does nothing with ncv, ncurses recognizes it and optimizes
   the output in favor of colors.

When TERM=linux, htop is *manually* assuming it can get 16 colors on an
8-color terminal using bold/blink (which happens to work on some terminals,
but is generally *not* reliable).

The correct thing to do is to use native support for 16 colors when
available, and fall back to 8 colors *without* bold/blink otherwise
(making sure to adjust the foreground if it matches the background -
dark blue is a common choice for black-on-black).

If you want to assume that everybody claiming they're TERM=linux really
supports 16 colors (remember that lots of terminal emulators lie! But -C
mode should suffice for liars), you should unconditionally change the
TERM=linux to TERM=linux-16color in the environment at startup.

As a short-term workaround (to avoid fixing all the buggy calls), do the
opposite: change TERM=linux-16color to TERM=linux during startup.

If there are any terminal entries which claim to only support 8 colors
but can actually support 16, they should have a similar terminfo entry
written if one doesn't already exist.

-Ben


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, x32, arm64

Kernel: Linux 4.8.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages htop depends on:
ii  libc6 2.24-8
ii  libncursesw5  6.0+20161126-1
ii  libtinfo5 6.0+20161126-1

htop recommends no packages.

Versions of packages htop suggests:
ii  lsof4.89+dfsg-0.1
ii  strace  4.15-2

-- no debconf information