From nobody@FreeBSD.org  Mon May  2 15:55:23 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB3ED1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 May 2011 15:55:23 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id C06458FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 May 2011 15:55:23 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p42FtNxu034309
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 2 May 2011 15:55:23 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p42FtNgH034308;
	Mon, 2 May 2011 15:55:23 GMT
	(envelope-from nobody)
Message-Id: <201105021555.p42FtNgH034308@red.freebsd.org>
Date: Mon, 2 May 2011 15:55:23 GMT
From: Alexandr <alter@alter.org.ua>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sockstat: missing spaces between long fields in output
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         156768
>Category:       bin
>Synopsis:       [patch] sockstat(1): missing spaces between long fields in output
>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:   Mon May 02 16:00:19 UTC 2011
>Closed-Date:    
>Last-Modified:  Sun Jun 30 13:40:00 UTC 2013
>Originator:     Alexandr
>Release:        7.2 RELEASE-p8
>Organization:
NetAssist
>Environment:
FreeBSD homecat.alter.org.ua 7.2-RELEASE-p8 FreeBSD 7.2-RELEASE-p8 #6: Sat Apr 23 12:52:20 EEST 2011     root@homecat.alter.org.ua:/usr/src/sys/i386/compile/CAT_v14c  i386

>Description:
FD field is too narrow. Space between columns may be missing if we have too large value.
>How-To-Repeat:

>Fix:
http://alter.org.ua/soft/fbsd/sockstat/fbsd72.sockstat.20110501.patch.gz

Patch attached with submission follows:

diff -crN orig/usr.bin/sockstat/sockstat.c new/usr.bin/sockstat/sockstat.c
*** orig/usr.bin/sockstat/sockstat.c	Wed Apr 20 10:38:46 2011
--- new/usr.bin/sockstat/sockstat.c	Wed Apr 20 10:38:46 2011
***************
*** 587,610 ****
  			pos += xprintf("%lu", (u_long)xf->xf_uid);
  		else
  			pos += xprintf("%s", pwd->pw_name);
! 		while (pos < 9)
  			pos += xprintf(" ");
! 		pos += xprintf("%.10s", getprocname(xf->xf_pid));
! 		while (pos < 20)
  			pos += xprintf(" ");
! 		pos += xprintf("%lu", (u_long)xf->xf_pid);
! 		while (pos < 26)
  			pos += xprintf(" ");
! 		pos += xprintf("%d", xf->xf_fd);
! 		while (pos < 33)
  			pos += xprintf(" ");
! 		pos += xprintf("%s", s->protoname);
  		if (s->vflag & INP_IPV4)
  			pos += xprintf("4");
  		if (s->vflag & INP_IPV6)
  			pos += xprintf("6");
! 		while (pos < 40)
  			pos += xprintf(" ");
  		switch (s->family) {
  		case AF_INET:
  		case AF_INET6:
--- 587,611 ----
  			pos += xprintf("%lu", (u_long)xf->xf_uid);
  		else
  			pos += xprintf("%s", pwd->pw_name);
! 		while (pos < 8)
  			pos += xprintf(" ");
! 		pos += xprintf(" %.10s", getprocname(xf->xf_pid));
! 		while (pos < 19)
  			pos += xprintf(" ");
! 		pos += xprintf(" %lu", (u_long)xf->xf_pid);
! 		while (pos < 25)
  			pos += xprintf(" ");
! 		pos += xprintf(" %d", xf->xf_fd);
! 		while (pos < 32)
  			pos += xprintf(" ");
! 		pos += xprintf(" %s", s->protoname);
  		if (s->vflag & INP_IPV4)
  			pos += xprintf("4");
  		if (s->vflag & INP_IPV6)
  			pos += xprintf("6");
! 		while (pos < 39)
  			pos += xprintf(" ");
+ 		pos += xprintf(" ");
  		switch (s->family) {
  		case AF_INET:
  		case AF_INET6:


>Release-Note:
>Audit-Trail:

From: Alter <alter@alter.org.ua>
To: bug-followup@FreeBSD.org, alter@alter.org.ua
Cc:  
Subject: Re: bin/156768: [patch] sockstat(1): missing spaces between long fields in output
Date: Thu, 14 Jun 2012 16:34:25 +0200

 Hello bug-followup,
 
 unified diff is now available at
 http://alter.org.ua/soft/fbsd/sockstat/fbsd72.sockstat.20120614u.patch.gz
 
 -- 
 Best regards,
  Alter                          mailto:alter@alter.org.ua
 

From: =?UTF-8?B?xYF1a2FzeiBXxIVzaWtvd3NraQ==?= <lukasz@wasikowski.net>
To: bug-followup@FreeBSD.org, alter@alter.org.ua
Cc:  
Subject: Re: bin/156768: [patch] sockstat(1): missing spaces between long
 fields in output
Date: Sun, 30 Jun 2013 15:32:11 +0200

 Hi,
 
 Could anyone look into this issue? sockstat output can't be used
 reliably in some cases - ie. rkhunter misses lines like this:
 
 teamspeak teamspeak_25690 18 tcp4   a.b.c.d:30033    *:*
 
 -- 
 best regards,
 Lukasz Wasikowski
>Unformatted:
