From andrew@ugh.net.au  Thu Dec 24 23:47:59 1998
Received: from beebite.ugh.net.au (ts1m18.the-gc.net [203.17.118.118])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA16031
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Dec 1998 23:47:56 -0800 (PST)
          (envelope-from andrew@ugh.net.au)
Received: (from andrew@localhost)
	by beebite.ugh.net.au (8.8.8/8.8.8) id RAA03844;
	Fri, 25 Dec 1998 17:42:52 GMT
	(envelope-from andrew)
Message-Id: <199812251742.RAA03844@beebite.ugh.net.au>
Date: Fri, 25 Dec 1998 17:42:52 GMT
From: andrew@ugh.net.au
Reply-To: andrew@ugh.net.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: tcplist port dosnt work
X-Send-Pr-Version: 3.2

>Number:         9191
>Category:       ports
>Synopsis:       tcplist port dosnt work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 24 23:50:01 PST 1998
>Closed-Date:    Mon Jun 28 02:53:10 PDT 1999
>Last-Modified:  Mon Jun 28 02:53:35 PDT 1999
>Originator:     Andrew
>Release:        FreeBSD 2.2.7-STABLE i386
>Organization:
UgH!
>Environment:

2.2.7-STABLE as of today. Latest version of lsof from ports (4.38). Latest
version of lsof from ports (2.2).

>Description:

tcplist doesn't do anything...if you dont have verbose on then you get no output
at all. It acts like there are no TCP connections open at all.

>How-To-Repeat:

tcplist

>Fix:
	
	It appears to be a problem with the way tcplist processed the output of
lsof.  The attached patch to lsof.c seems to fix it.


--- lsof.c.orig	Sat Dec 26 03:08:49 1998
+++ lsof.c	Sat Dec 26 03:33:46 1998
@@ -27,7 +27,7 @@
 #define LSOFCMD  "lsof -HPsli TCP | awk '{print $3,$NF}' | sort | uniq"
 #else /* !OLDLSOF */
 /* These use the current (as of 3.62W, at least) parameters for lsof */
-#define LSOFCMD  "lsof -nPsli TCP | awk '{print $3,$NF}' | sort | uniq"
+#define LSOFCMD  "lsof -nPsli TCP | awk '{print $3,$(NF - 1)}' | sort | uniq"
 #endif /* !OLDLSOF */
 #endif /* LSOFCMD */
 

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->obrien 
Responsible-Changed-By: obrien 
Responsible-Changed-When: Fri Dec 25 10:00:04 PST 1998 
Responsible-Changed-Why:  
lsof is mine 

From: "David O'Brien" <motminh@NUXI.com>
To: freebsd-gnats-submit@freebsd.org, andrew@ugh.net.au
Cc:  Subject: Re: pending/9191: tcplist port dosnt work
Date: Fri, 25 Dec 1998 10:01:10 -0800

 > 2.2.7-STABLE as of today. Latest version of lsof from ports (4.38). Latest
 > version of lsof from ports (2.2).
 
 I'm sorry, I can't parse this.
 There is no such thing as 2.2.7-STABLE in Dec. 1998.  By chance do you
 mean 2.2.8-STABLE?  Also, I don't quite understand what piece of
 software
 is at version 2.2.
 
 -- David

From: Sheldon Hearn <sheldonh@iafrica.com>
To: freebsd-gnats-submit@freebsd.org
Cc: obrien@freebsd.org
Subject: Re: ports/9191: tcplist port dosnt work
Date: Tue, 09 Mar 1999 12:15:02 +0200

 Hi David,
 
 I've looked into PR 9191 on a 4.0-CURRENT box using lsof-4.41 built out
 of ports.
 
 Tcplist reports (with or without the originator's patch):
 
 # tcplist
 tcplist: Can't get lsof output header
 #
 
 However, this looks more like odd behaviour from lsof than from tcplist:
 
 # lsof -nPsli TCP
 lsof: PID 50024, no realloc file * space
 #
 
 There is no such process, and I was into the 99000's with process ids for
 new processes when this happened.
 
 Ciao,
 Sheldon.
 

From: andrew@ugh.net.au
To: freebsd-gnats-submit@freebsd.org
Cc: obrien@freebsd.org, sheldonh@iafrica.com
Subject: Re: ports/9191: tcplist port dosnt work
Date: Fri, 11 Jun 1999 13:13:03 +1000 (EST)

 Hi,
 
 I did reply to David's response to the pr at the time he made it however
 it doesn't seem to have made it into the pr database and as I just got the
 same problem I'm posting again :-)
 
 > Also, I don't quite understand what piece of software is at version 2.2.
 
 I can't remember all the versions numbers from the original report but it
 was tcplist that was at version 2.2. Rereading my initial pr I've decided
 it didn't make much sense at all.
 
 
 To restate the problem...hopefully in a way that makes more sense and with
 a newer versions of the software involved...
 
 Using FreeBSD 3.2-STABLE, cvsuped a few days ago. Output of uname -r:
 
 3.2-STABLE
 
 Using lsof version 4.43 from the ports collection. Output of lsof -v:
 
 lsof version information:
     revision: 4.43 -- find the latest revision at:
         ftp://vic.cc.purdue.edu/pub/tools/unix/lsof
     constructed: Fri Jun 11 12:40:49 EST 1999
     constructed by and on: acs@depravitas.tuu.utas.edu.au
     compiler: gcc
     compiler flags: -pipe -DHASRPCV2H -DFREEBSDV=320 -DHASFDESCFS
 -DHASPROCFS -DHAS9660FS -DLSOF_VSTR="3.2-STABLE" -I/usr/include
 -I/usr/src/sys -O2
     loader flags: -L./lib -llsof -lkvm
     system info: FreeBSD depravitas.tuu.utas.edu.au 3.2-STABLE FreeBSD
 3.2-STABLE #0: Fri Jun 11 11:00:35 EST 1999
 root@depravitas.tuu.utas.edu.au:/usr/src/sys/compile/DEPRAVITAS i386
 
 Using tcplist version 2.2 from the ports collection. Output of tcplist -V:
 
 tcplist Version 2.2 $Id: patchlevel.h,v 1.8 1997/04/24 18:54:06 jdd Exp $
 
 If I run tcplist with no options I get no output and an exit value of 0.
 If I apply the patch included in the pr to lsof.c and recompile I get the
 expected output.
 
 Does tcplist work for you, unpatched?
 
 Thanks,
 
 Andrew
 
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: Andrew <andrew@ugh.net.au>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: ports/9191: tcplist port dosnt work
Date: Mon, 21 Jun 1999 16:24:58 +0200

 Hi Andrew,
 
 In trying to test the port, I've discovered I get an error trying to
 unpack the shar. When I run the shar manually, I get the following
 error:
 
 : bad variable name
 /usr/ports/distfiles/tcplist-2.2.shar: 2180: Syntax error: end of file unexpected (expecting "then")
 
 I'm using bash2 on CURRENT. You wanna look into this?
 
 Ciao,
 Sheldon.
 
State-Changed-From-To: open->feedback 
State-Changed-By: sheldonh 
State-Changed-When: Mon Jun 21 07:34:11 PDT 1999 
State-Changed-Why:  
Waiting on submitter for feedback. 

From: andrew@ugh.net.au
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: ports/9191: tcplist port dosnt work
Date: Tue, 22 Jun 1999 09:57:40 +1000 (EST)

 On Mon, 21 Jun 1999, Sheldon Hearn wrote:
 
 > unpack the shar. When I run the shar manually, I get the following
 > error:
 > 
 > : bad variable name
 > /usr/ports/distfiles/tcplist-2.2.shar: 2180: Syntax error: end of file unexpected (expecting "then")
 > 
 > I'm using bash2 on CURRENT. You wanna look into this?
 
 Well I get the same error having grabbed the file from ftp.au.freebsd.org
 using fetch (i.e typing make in the port directory) (I used /bin/sh to
 extract). If I grab the same file via ncftp3 (from the same site) it
 expands fine...
 
 File got via fetch -> 55890 bytes
 File got via ncftp3 -> 53711 bytes
 
 I have tried the FTP with both tools multiple times and this is
 reproducible. The file ftped with ncftp3 has the correct md5 checksum.
 
 I tried using ftp.freebsd.org and got the same results (ncftp3 gets the
 file fine, fetch dosn't and the md5 checksums tally with those I got on
 the files from ftp.au.freebsd.org)
 
 Same goes for ftp.cdf.toronto.edu (the master site).
 
 Suspecting a bug in fetch at this point I tired /usr/bin/ftp as I think it
 uses the same code base? /usr/bin/ftp ftped the file successfully however
 (I only tried with ftp.au.freebsd.org).
 
 The thought then occured...I wonder if fetch is trying to use a proxy? The
 machine I'm testing on needs to use a web proxy to get out on port 80
 although it can ftp with out a proxy.
 
 Checking the environment, HTTP_PROXY was set but FTP_PROXY wasn't. I typed
 make again and did a netstat. Fetch was using the proxy specified in the
 HTTP_PROXY environment variable. I unset the variable, deleted the broken
 file fetch ftped and typed make again. This time fetch didn't use the
 proxy and the file arrived fine (md5 matched).
 
 Clearly the file cached in the local proxy here is a few bytes short and
 thats all fetch ever retreived...the questions that occur is how did that
 happen and why did exactly the same thing happen to you? I got exactly the
 same error message so perhaps the file was truncated in the same place?
 What was the md5 checksum on your file? Are you using a proxy?
 
 The proxy in use here appears to be Squid/2.1.PATCH2...It will be running
 under Solaris.
 
 Thanks,
 
 Andrew
 
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: andrew@ugh.net.au
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: ports/9191: tcplist port dosnt work 
Date: Tue, 22 Jun 1999 11:22:44 +0200

 On Tue, 22 Jun 1999 09:57:40 +1000, andrew@ugh.net.au wrote:
 
 > File got via fetch -> 55890 bytes
 > File got via ncftp3 -> 53711 bytes
 
 You're spot on. When I unset ftp_proxy, I get the file intact. I use
 /usr/bin/pftp as my FETCH_CMD.
 
 I'm at a loss as to what the problem is, since the files, which look
 identical, make for a useless diff. :-(
 
 Now, about the original problem.
 
 All I can tell you is this; if you include /usr/local/sbin in your PATH
 for the build of the port, and it's in your PATH when you run the
 program, it'll work. If not, it won't. :-)
 
 Ooops, you should know that I'm also using the patch below. However,
 what I said above about the PATH still stands.
 
 Sorry I can't provide a proper solution, but I have very little interest
 in tcplist since DES added sockstat to the base system. :-(
 
 Ciao,
 Sheldon.
 
 --- lsof.c.orig	Tue Mar  9 11:49:40 1999
 +++ lsof.c	Tue Mar  9 11:51:17 1999
 @@ -27,7 +27,7 @@
  #define LSOFCMD  "lsof -HPsli TCP | awk '{print $3,$NF}' | sort | uniq"
  #else /* !OLDLSOF */
  /* These use the current (as of 3.62W, at least) parameters for lsof */
 -#define LSOFCMD  "lsof -nPsli TCP | awk '{print $3,$NF}' | sort | uniq"
 +#define LSOFCMD  "lsof -nPsli TCP | awk '{print $3,$(NF - 1)}' | sort | uniq"
  #endif /* !OLDLSOF */
  #endif /* LSOFCMD */
  
 
State-Changed-From-To: feedback->open 
State-Changed-By: sheldonh 
State-Changed-When: Tue Jun 22 03:33:31 PDT 1999 
State-Changed-Why:  
Required feedback proivided, back to the port's maintainer. 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Mon Jun 28 02:53:10 PDT 1999 
State-Changed-Why:  
Committed, thanks! 
>Unformatted:
