Bug 258409 - top(1) outputs blank lines when TERM is not set
Summary: top(1) outputs blank lines when TERM is not set
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-09-10 15:59 UTC by Ryan Moeller
Modified: 2021-09-10 16:00 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Moeller freebsd_committer 2021-09-10 15:59:07 UTC
We capture the output of top -SHIwz -d 2 in a debug script, but there are no processes shown. The lines for the processes are all blank.

Upon investigation, this only occurs when TERM is not set in the environment. This can be easily reproduced:

$ env TERM=dumb top -SHIwz -d 2 | cat

Processes are listed.

$ env -u TERM top -SHIwz -d 2 | cat

Blank lines are displayed where processes should be listed.

We are working around this issue with -n to force non-interactive mode, but it would be good to fix top since screen_width = 0 doesn't seem like it would ever be what someone actually wants.

I've reproduced this on 12 13 and CURRENT.