Bug 187240 - sysutils/tcplist incompatible with sysutils/lsof
Summary: sysutils/tcplist incompatible with sysutils/lsof
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-04 02:40 UTC by Chris Hutchinson
Modified: 2014-07-28 03:24 UTC (History)
2 users (show)

See Also:


Attachments
tcplist.diff (568 bytes, patch)
2014-03-04 07:31 UTC, R.Mahmatkhanov
no flags Details | Diff
tcplist.diff (570 bytes, patch)
2014-03-04 08:00 UTC, R.Mahmatkhanov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Hutchinson 2014-03-04 02:40:00 UTC
For me, sysutils/tcplist stopped working, about 1.5yrs agao. I really miss it. So Here's a PR, in hopes it can/will be fixed. Basically, when using it with, or without options, it always emits the same output/error:

# tcplist
lsof: unknown -s protocol: "li"
lsof 4.88
 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
 latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
 latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
 usage: [-?abChKlnNoOPRtUvV] [+|-c c] [+|-d s] [+|-D D] [+|-f[cfgGn]]
 [-F [f]] [-g [s]] [-i [i]] [-k k] [+|-L [l]] [-m m] [+|-M] [-o [o]] [-p s]
[+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.
tcplist: Can't get lsof output header

Nothing more, nothing less.
All versions (tcplist/lsof) are current as of end of Feb 27 2014.

Thank you for all your time, and consideration.

--Chris

Fix: 

unknown
How-To-Repeat: install / use sysutils/tcplist
Comment 1 R.Mahmatkhanov 2014-03-04 07:31:38 UTC
Hi,

this patch will fix lsof command (it works while running manually), but 
tcplist itself is still broken, because it doesn't output anything.

By the way, doesn't sockstat(1) is what you looking for? F.e.:

[rm@smeshariki4 tcplist]> sudo sockstat -4l
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS  FOREIGN ADDRESS
root     sshd       84319 4  tcp4   *:22                  *:*
mysql    mysqld     84283 10 tcp4   *:3306                *:*
www      httpd      84169 4  tcp4   *:80                  *:*
www      httpd      84168 4  tcp4   *:80                  *:*
www      httpd      84167 4  tcp4   *:80                  *:*
www      httpd      84166 4  tcp4   *:80                  *:*
www      httpd      84165 4  tcp4   *:80                  *:*
www      httpd      84164 4  tcp4   *:80                  *:*
root     httpd      84163 4  tcp4   *:80                  *:*

-- 
Regards,
Ruslan

T.O.S. Of Reality
Comment 2 R.Mahmatkhanov 2014-03-04 08:00:15 UTC
So, this is proper lsof commandline. It outputs like:

uid x.x.x.x:10859->y.y.y.y:22
uid x.x.x.x:16573->y.y.y.y:80
uid x.x.x.x:19337->y.y.y.y:80

and tcplist now fails with:
select: Bad file descriptor

Looks like the code needs to be updated to modern network stuff.

-- 
Regards,
Ruslan

T.O.S. Of Reality
Comment 3 Chris Hutchinson 2014-03-04 14:56:15 UTC
Greetings, Ruslan, and thank you very much for the response.
> Hi,
>
> this patch will fix lsof command (it works while running manually), but
> tcplist itself is still broken, because it doesn't output anything.

Ahh, I see. Thanks for taking the time to do this.

>
> By the way, doesn't sockstat(1) is what you looking for? F.e.:
>
> [rm@smeshariki4 tcplist]> sudo sockstat -4l
> USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS  FOREIGN ADDRESS
> root     sshd       84319 4  tcp4   *:22                  *:*
> mysql    mysqld     84283 10 tcp4   *:3306                *:*
> www      httpd      84169 4  tcp4   *:80                  *:*
> www      httpd      84168 4  tcp4   *:80                  *:*
> www      httpd      84167 4  tcp4   *:80                  *:*
> www      httpd      84166 4  tcp4   *:80                  *:*
> www      httpd      84165 4  tcp4   *:80                  *:*
> www      httpd      84164 4  tcp4   *:80                  *:*
> root     httpd      84163 4  tcp4   *:80                  *:*

Indeed. In my struggle to retreive similar output from something else, I remembered
sockstat(1). :)

>
> --
> Regards,
> Ruslan
>
> T.O.S. Of Reality
>

Thanks again, for all your time, and attention to this.

--Chris
Comment 4 John Marino freebsd_committer freebsd_triage 2014-07-22 18:59:13 UTC
There is no maintainer for this port, so somebody should commit Ruslan's patch
Comment 5 commit-hook freebsd_committer freebsd_triage 2014-07-27 09:06:22 UTC
A commit references this bug:

Author: marino
Date: Sun Jul 27 09:05:49 UTC 2014
New revision: 363030
URL: http://svnweb.freebsd.org/changeset/ports/363030

Log:
  sysutils/tcplist: Fix compatiblity with sysutils/lsof

  PR:		187240
  Submitted by:	Chris Hutchinson
  Fix by:		Ruslan

Changes:
  head/sysutils/tcplist/Makefile
  head/sysutils/tcplist/files/patch-03
Comment 6 John Marino freebsd_committer freebsd_triage 2014-07-27 09:07:51 UTC
Okay, fix is in!
Comment 7 Chris Hutchinson 2014-07-28 03:24:19 UTC
Excellent work, as usual John. Thank you!
You still get my vote for Commit Bit of the year. :)

--Chris