top -n -o res for example shows empty output (I think it breaks after commit r336150) The output looks like ast pid: 85237; load averages: 0.26, 0.35, 0.38 up 0+06:27:10 21:45:37 95 processes: 2 running, 93 sleeping CPU: 2.4% user, 0.0% nice, 0.9% system, 0.1% interrupt, 96.6% idle Mem: 1G Active, 3G Inact, 412M Laundry, 5G Wired, 2G Buf, 5G Free ARC: 1G Total, 54M MFU, 417M MRU, 1M Anon, 18M Header, 704M Other 108M Compressed, 363M Uncompressed, 3.36:1 Ratio Swap: 2G Total, 2G Free -------------- From swap down, all empty.
I plan on looking at this. Note that my development computer is currently dead so progress will be slow.
Created attachment 195231 [details] Fix screen_width in batch mode Please kindly apply the following patch. Actually this bug occurred in the past, from Changes top shipped with FreeBSD < 12 "Wed Dec 15 1993 - wnl (3.3beta2) .... Fixed bug with batch mode (screen_width wasn't getting set). ...."
r336028 is the rev that changed this from MAX_COLS to 0. The patch is incorrect. screen_width must be dynamically set. If we are to make assumptions about dumb terminal screen width it would have to be within the if (!interactive) block. Adding the committer of r336028 to the cc list.
Please check https://reviews.freebsd.org/D16455 I will commit it if there is no problem. Thank you.
A commit references this bug: Author: daichi Date: Fri Jul 27 01:20:34 UTC 2018 New revision: 336753 URL: https://svnweb.freebsd.org/changeset/base/336753 Log: top(1): fixed the empty output problem in non-interactive mode (-n, -b) regressed in r336028 PR: 229842 Reported by: Ali Abdallah <aliovx@gmail.com> Reviewed by: eadler, cy Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D16455 Changes: head/usr.bin/top/screen.c