bin/158775: top(1)'s output when using 'C' and 'H' interactively is inconsistent with the other interactive keys

Alexander Best arundel at FreeBSD.org
Sun Jul 10 19:10:11 UTC 2011


>Number:         158775
>Category:       bin
>Synopsis:       top(1)'s output when using 'C' and 'H' interactively is inconsistent with the other interactive keys
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 10 19:10:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Best
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #20 r223849=be9ff60-dirty: Fri Jul  8 04:39:15 CEST 2011     arundel at otaku:/usr/obj/usr/git-freebsd-head/sys/ARUNDEL  amd64
>Description:
when using the interaactive key commands in top, such as 'z' or 't', the output is being displayed with an extra space before it. this is useful, because the first character is occupied by the blinking cursor and thus improves readability of the output.

for the 'C' and 'H' keys however this isn't the case. no extra space is being displayed before the output and thus the first character collides with the cursors postion.

the attached patch should fix the problem.

please note that for interactive commands such as 'u' or 's' the situation is different. the cursor jumps to the end of the output, because the user is requested to input further information. for these messages not having an extra space at their beginning is OK.
>How-To-Repeat:
run 'top' and compare the output of the 'C' and 'H' command, compared to 'z' or 't' e.g.
>Fix:


Patch attached with submission follows:

diff --git a/contrib/top/top.c b/contrib/top/top.c
index 6673a27..31dd869 100644
--- a/contrib/top/top.c
+++ b/contrib/top/top.c
@@ -1019,7 +1020,7 @@ restart:
 			    case CMD_thrtog:
 				ps.thread = !ps.thread;
 				new_message(MT_standout | MT_delayed,
-				    "Displaying threads %s",
+				    " Displaying threads %s",
 				    ps.thread ? "separately" : "as a count");
 				header_text = format_header(uname_field);
 				reset_display();
@@ -1028,7 +1029,7 @@ restart:
 			    case CMD_wcputog:
 				ps.wcpu = !ps.wcpu;
 				new_message(MT_standout | MT_delayed,
-				    "Displaying %sCPU",
+				    " Displaying %sCPU",
 				    ps.wcpu ? "W" : "");
 				header_text = format_header(uname_field);
 				reset_display();



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list