From nobody@FreeBSD.org  Wed Jul 31 04:52:01 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 2744CEC7
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 Jul 2013 04:52:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 149D32962
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 Jul 2013 04:52:01 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r6V4q07D034617
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 Jul 2013 04:52:00 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r6V4q0XM034610;
	Wed, 31 Jul 2013 04:52:00 GMT
	(envelope-from nobody)
Message-Id: <201307310452.r6V4q0XM034610@oldred.freebsd.org>
Date: Wed, 31 Jul 2013 04:52:00 GMT
From: Danilo Ega Gondolfo <danilogondolfo@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Fix top command format when JID with 4 characters is displayed
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         180961
>Category:       bin
>Synopsis:       [patch] top(1): Fix top command format when JID with 4 characters is displayed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 31 05:00:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Fri Aug 02 02:05:13 UTC 2013
>Originator:     Danilo Ega Gondolfo
>Release:        FreeBSD 9.2-BETA1
>Organization:
>Environment:
FreeBSD freebsd 9.2-BETA1 FreeBSD 9.2-BETA1 #7 r253479: Sat Jul 20 06:52:49 BRT 2013     root@freebsd:/usr/obj/usr/src/sys/PROJETO  amd64

>Description:
When JID is displayed with 4 letters, the screen shows an little bug.

You can see it here https://dl.dropboxusercontent.com/u/23276705/top1.png
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- machine.c.orig	2013-07-31 04:31:38.000000000 -0300
+++ machine.c	2013-07-31 04:29:31.000000000 -0300
@@ -406,7 +406,7 @@
 		    (ps.thread ? smp_header : smp_header_thr) :
 		    (ps.thread ? up_header : up_header_thr);
 		snprintf(Header, sizeof(Header), prehead,
-		    ps.jail ? " JID" : "",
+		    ps.jail ? "   JID" : "",
 		    namelength, namelength, uname_field,
 		    ps.wcpu ? "WCPU" : "CPU");
 		break;
@@ -800,7 +800,7 @@
 	int cpu, state;
 	struct rusage ru, *rup;
 	long p_tot, s_tot;
-	char *proc_fmt, thr_buf[6], jid_buf[6];
+	char *proc_fmt, thr_buf[6], jid_buf[8];
 	char *cmdbuf = NULL;
 	char **args;
 



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