NetBSD Problem Report #50487

From www@NetBSD.org  Sun Nov 29 03:46:57 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 29E8DA6551
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Nov 2015 03:46:57 +0000 (UTC)
Message-Id: <20151129034655.77B74A65C4@mollari.NetBSD.org>
Date: Sun, 29 Nov 2015 03:46:55 +0000 (UTC)
From: dhgutteridge@sympatico.ca
Reply-To: dhgutteridge@sympatico.ca
To: gnats-bugs@NetBSD.org
Subject: Update sysutils/lsof to version 4.88 (changes attached)
X-Send-Pr-Version: www-1.0

>Number:         50487
>Category:       pkg
>Synopsis:       Update sysutils/lsof to version 4.88 (changes attached)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bsiegert
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 29 03:50:00 +0000 2015
>Closed-Date:    Tue Dec 29 13:05:21 +0000 2015
>Last-Modified:  Tue Dec 29 13:05:21 +0000 2015
>Originator:     David H. Gutteridge
>Release:        current
>Organization:
>Environment:
>Description:
sysutils/lsof is now at version 4.88. Change log is below.

Reduced to 50 the number of open file descriptors lsof
attempts to close while trying to protect itself from a
file descriptor exec() attack.  This limits the overhead
lsof incurs on systems that have large file descriptor
limits, yet provides sufficient open descriptors for the
library functions lsof calls.

Updated for changes in FreeBSD 10 with advice from Eygene
Ryabinkin <rea@freebsd.org>.  Taught Configure to recognize
FreeBSD 8.4.

Herein am noting that lsof for Solaris 10 or 11 is no longer
supported.  I no longer have test systems.  Some support is
still available from Casper Dik <Casper.Dik@oracle.com> and a
Solaris 11 patch he provided is included in this revision.

Initialized local variables in the Linux process_id() function.
Jia He <jiakernel@gmail.com> reported the problem.

Added support for FreeBSD 11.

Updated FreeBSD ZFS Configure stanza to supply a dummy
opt_kdtrace.h when needed.

Added tmpfs file system support for FreeBSD.

Since a test system is no longer available, dropped the
claim of FreeBSD 4.9 support.

Added the +|-E options for Linux.  -E displays endpoint info;
+E displays endpoint info and endpopint files.  Masatake YAMATO
<yamato@redhat.com> requested this support and suggested code
to implement it.

Fixed a Linux bug handling processes whose command includes a
non-printing character, particularly a NEWLINE character, and
clarified printing of single '\\' characters in command and
file names.  Stephane Chazelas <stephane.chazelas@gmail.com>
reported the problem. 

Added support for Linux RDMA and CRYPTO protocal names and UNIX
socket type with code from Masatake YAMATO <yamato@redhat.com>.

Fixed field output to insure that the field descriptor field is
always selected, since it identifies the file set.  The bug was
reported by Gary Plewa <gary.m.plewa-1@lowes.com>.

>How-To-Repeat:
(Note the package is outdated.)
>Fix:
The changes are trivial except I had to regenerate patch-ag both
because it wouldn't apply without fuzz and because it didn't
include references to NetBSD 7.0 and 7.99.

--- Makefile.orig       2015-06-15 21:58:17.000000000 -0400
+++ Makefile    2015-11-28 21:56:43.000000000 -0500
@@ -1,8 +1,7 @@
 # $NetBSD: Makefile,v 1.120 2015/06/12 10:51:14 wiz Exp $

-DISTNAME=              lsof_4.87
+DISTNAME=              lsof_4.88
 PKGNAME=               ${DISTNAME:S/_/-/}
-PKGREVISION=           2
 CATEGORIES=            sysutils
 MASTER_SITES=          ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/  \
                        ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/NEW/ \

--- distinfo.orig       2015-11-28 22:06:38.000000000 -0500
+++ distinfo    2015-11-28 22:26:29.000000000 -0500
@@ -1,15 +1,15 @@
 $NetBSD: distinfo,v 1.85 2015/11/04 01:32:20 agc Exp $

-SHA1 (lsof_4.87.tar.bz2) = 68e61e0a45491420ace80770157206328c27d8c4
-RMD160 (lsof_4.87.tar.bz2) = 27aff2ec91dd8ece34ffee6f2be7e328c78552e3
-SHA512 (lsof_4.87.tar.bz2) = 5e811225dd65366e3ef49628d567864fadda1dbda2d66a5e473123e73c468f5a3a577ae4e1b701a55ac49c2a759dab5c413663121c260a2804fca10ece902766
-Size (lsof_4.87.tar.bz2) = 773664 bytes
+SHA1 (lsof_4.88.tar.bz2) = 09db6d2cd96bc6832d9b767084b9c67cf5cf52bb
+RMD160 (lsof_4.88.tar.bz2) = fdfc5a5c8c8d4915c8bbd0c2ebe4ec3393fd98d9
+SHA512 (lsof_4.88.tar.bz2) = acf3901ac08bac5acaa123af835de03fcf86c1cb851a2cba5bb6d08c53dff62570e4129c18ffa241ae84a83d5e6fc5207fb12e43b5ff5a21a0c1967ca117848b
+Size (lsof_4.88.tar.bz2) = 778563 bytes
 SHA1 (patch-aa) = 4469a5fed540e3c5635b6082efedc477ea96a382
 SHA1 (patch-ab) = 1501d8b0e6fd2c61949ba0d447c7b726655725c4
 SHA1 (patch-ac) = dac0fcdfee97d42c8f23684a4321519b9f8698d9
 SHA1 (patch-ad) = 4bd73dea4770c7f5a43be0d096c26e7d6728dd2c
 SHA1 (patch-ae) = 1d8c1c3baf9575631c23d3ced7b12fab1df95cd6
 SHA1 (patch-af) = b52c15a507960ecf33a61a3cbd608a92ebac1188
-SHA1 (patch-ag) = 5a48b4036d65af7cb6da0a1c89e06f02ae921ac6
+SHA1 (patch-ag) = bb7f2b22cd667b266cec00c7c8706b68c6665d24
 SHA1 (patch-ah) = 2de22b9a3733f958298af5e33b66c0653c320f59
 SHA1 (patch-dialects_n+obsd_dnode1.c) = dc8c766760aca4eb2e7d7af3944260dd49795c09

New patch-ag is:

--- Configure.orig      2014-10-13 18:31:13.000000000 -0400
+++ Configure   
@@ -103,6 +103,7 @@
 #      $LSOF_LOCALSUFFIX   local suffix for Makefile
 #      $LSOF_NBSD_BUFQH    NetBSD <sys/bufq.h> copy status
 #      $LSOF_NBSD_PTYFS    NetBSD ${NETBSD_SYS}/sys/fs/ptyfs/ copy status
+#      $LSOF_NBSD_TMPFS    NetBSD ${NETBSD_SYS}/sys/fs/tmpfs/ copy status
 #      $LSOF_N_UNIXV       *BSD system's kernel file
 #      $LSOF_OPINC         supplies additional -I/path arguments for the
 #                          Makefile's CFLAGS.
@@ -2910,6 +2911,11 @@
       # Validate the NetBSD version.

       case $LSOF_VSTR in       # {
+      0*|1.[01]*)
+       LSOF_VERS="1006000"
+       echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
+       echo "!!!WARNING!!!  Configuring for NetBSD 1.2"
+       ;;
       1.2*)
        LSOF_VERS="1002000"
        ;;
@@ -2966,10 +2972,52 @@
        echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
        echo "!!!WARNING!!!  Configuring for NetBSD 3.0"
        ;;
+      4.0*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="4000000"
+       ;;
+      4.99.*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="4099000"
+       ;;
+      4*)
+       LSOF_VERS="4000000"
+       echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
+       echo "!!!WARNING!!!  Configuring for NetBSD 4.0"
+       ;;
+      5.[012]*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="5000000"
+       ;;
+      5.99.*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="5099000"
+       ;;
+      5*)
+       LSOF_VERS="5000000"
+       echo "!!!WARNING!!!  Unsupported NetBSD version: $LSOF_VSTR"
+       echo "!!!WARNING!!!  Configuring for NetBSD 5.0"
+       ;;
+      6.0*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="6000000"
+       ;;
+      6.99.*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="6099000"
+       ;;
+      7.0*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="7000000"
+       ;;
+      7.99.*)
+       LSOF_TSTBIGF=" "
+       LSOF_VERS="7099000"
+       ;;
       *)
+       LSOF_VERS="5000000"
        echo "Unknown NetBSD release: $LSOF_VSTR"
-       echo Assuming NetBSD 1.6
-       LSOF_VERS="1006000"
+       echo "!!!WARNING!!!  Configuring for NetBSD 5.0"
        ;;
       esac     # }
     fi # }
@@ -2983,6 +3031,14 @@
       ;;
     3000000|3099000)
       ;;
+    4000000|4099000)
+      ;;
+    5000000|5099000)
+      ;;
+    6000000|6099000)
+      ;;
+    7000000|7099000)
+      ;;
     *)
       echo "Unknown NetBSD version: $LSOF_VERS"
       rm -f $LSOF_HLP
@@ -2991,7 +3047,10 @@
     esac       # }
     LSOF_CFGF="$LSOF_CFGF -DNETBSDV=$LSOF_VERS"
     LSOF_TMP1="-DN_UNIXV=/netbsd"
-    if test -r ${LSOF_INCLUDE}/util.h  # {
+    if test -r /dev/ksyms              # {
+    then
+      LSOF_TMP1="-DN_UNIXV=/dev/ksyms"
+    elif test -r ${LSOF_INCLUDE}/util.h        # {
     then
       grep -q getbootfile ${LSOF_INCLUDE}/util.h
       if test $? -eq 0 # {
@@ -3390,6 +3449,7 @@
     fi # }
     LSOF_TMP2="sys/vnode.h"
     LSOF_NBSD_PTYFS=0
+    LSOF_NBSD_TMPFS=0
     if test -r ${LSOF_INCLUDE}/$LSOF_TMP2      # {
     then
       LSOF_TMP3="${LSOF_INCLUDE}/$LSOF_TMP2"
@@ -3467,6 +3527,24 @@
          fi    # }
        fi      # }
       fi       # }
+      grep -q VT_TMPFS $LSOF_TMP3
+      if test $? -eq 0   # {
+      then
+       LSOF_TMP2="fs/tmpfs/tmpfs.h"
+       if test -r ${LSOF_INCLUDE}/$LSOF_TMP2   # {
+       then
+         LSOF_CFGF="$LSOF_CFGF -DHASTMPFS"
+       else
+         if test -r ${NETBSD_SYS}/$LSOF_TMP2   # {
+         then
+           if test $NETBSD_SYS != $LSOF_INCLUDE        # {
+           then
+             LSOF_CFGF="$LSOF_CFGF -DHASTMPFS"
+             LSOF_NBSD_TMPFS=1
+           fi  # }
+         fi    # }
+       fi      # }
+      fi       # }
       if test "X$NETBSD_UVM" = "X"     # {
       then
        grep -q UVM $LSOF_TMP3
@@ -3752,6 +3830,28 @@
        LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
       fi       # }
     fi # }
+    if test $LSOF_NBSD_TMPFS -eq 1     # {
+    then
+
+    # Make a local copy of $NETBSD_SYS/sys/fs/tmpfs/tmpfs.h.
+
+      if test ! -d dialects/n+obsd/include     # {
+      then
+       mkdir dialects/n+obsd/include
+      fi       # }
+      if test ! -d dialects/n+obsd/include/fs  # {
+      then
+       mkdir dialects/n+obsd/include/fs
+      fi       # }
+      rm -rf dialects/n+obsd/include/fs/tmpfs
+      mkdir dialects/n+obsd/include/fs/tmpfs
+      cp $NETBSD_SYS/fs/tmpfs/tmpfs.h dialects/n+obsd/include/fs/tmpfs
+      echo $LSOF_CFGF | grep /dialects/n+obsd/include > /dev/null 2>&1
+      if test $? -ne 0 # {
+      then
+       LSOF_CFGF="$LSOF_CFGF -I`pwd`/dialects/n+obsd/include"
+      fi       # }
+    fi # }
     LSOF_CFGL="$LSOF_CFGL -lkvm"
     LSOF_DIALECT_DIR=n+obsd
     ;;
@@ -5488,7 +5588,7 @@
 echo "" >> $LSOF_MKFC
 if test "X$LSOF_DEBUG" = "X"   # {
 then
-  LSOF_DEBUG="-O"
+  LSOF_DEBUG=""
 else
   if test "X$LSOF_DEBUG" = "XNo-O"     # {
   then

>Release-Note:

>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/50487: Update sysutils/lsof to version 4.88 (changes
 attached)
Date: Sun, 29 Nov 2015 13:54:52 +0100

 On Sun, Nov 29, 2015 at 03:50:00AM +0000, dhgutteridge@sympatico.ca wrote:
 > Reduced to 50 the number of open file descriptors lsof
 > attempts to close while trying to protect itself from a
 > file descriptor exec() attack.  This limits the overhead
 > lsof incurs on systems that have large file descriptor
 > limits, yet provides sufficient open descriptors for the
 > library functions lsof calls.

 Of course, it would help if they actually used closefrom(2) or friends
 on systems where it exists...

 Joerg

From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50487 CVS commit: pkgsrc/sysutils/lsof
Date: Tue, 29 Dec 2015 12:42:58 +0000

 Module Name:	pkgsrc
 Committed By:	bsiegert
 Date:		Tue Dec 29 12:42:58 UTC 2015

 Modified Files:
 	pkgsrc/sysutils/lsof: Makefile distinfo
 	pkgsrc/sysutils/lsof/patches: patch-ag

 Log Message:
 Update lsof to 4.88. From David H. Gutteridge in PR pkg/50487.

 Reduced to 50 the number of open file descriptors lsof
 attempts to close while trying to protect itself from a
 file descriptor exec() attack.  This limits the overhead
 lsof incurs on systems that have large file descriptor
 limits, yet provides sufficient open descriptors for the
 library functions lsof calls.

 Updated for changes in FreeBSD 10 with advice from Eygene
 Ryabinkin <rea@freebsd.org>.  Taught Configure to recognize
 FreeBSD 8.4.

 Herein am noting that lsof for Solaris 10 or 11 is no longer
 supported.  I no longer have test systems.  Some support is
 still available from Casper Dik <Casper.Dik@oracle.com> and a
 Solaris 11 patch he provided is included in this revision.

 Initialized local variables in the Linux process_id() function.
 Jia He <jiakernel@gmail.com> reported the problem.

 Added support for FreeBSD 11.

 Updated FreeBSD ZFS Configure stanza to supply a dummy
 opt_kdtrace.h when needed.

 Added tmpfs file system support for FreeBSD.

 Since a test system is no longer available, dropped the
 claim of FreeBSD 4.9 support.

 Added the +|-E options for Linux.  -E displays endpoint info;
 +E displays endpoint info and endpopint files.  Masatake YAMATO
 <yamato@redhat.com> requested this support and suggested code
 to implement it.

 Fixed a Linux bug handling processes whose command includes a
 non-printing character, particularly a NEWLINE character, and
 clarified printing of single '\\' characters in command and
 file names.  Stephane Chazelas <stephane.chazelas@gmail.com>
 reported the problem.

 Added support for Linux RDMA and CRYPTO protocal names and UNIX
 socket type with code from Masatake YAMATO <yamato@redhat.com>.

 Fixed field output to insure that the field descriptor field is
 always selected, since it identifies the file set.  The bug was
 reported by Gary Plewa <gary.m.plewa-1@lowes.com>.


 To generate a diff of this commit:
 cvs rdiff -u -r1.120 -r1.121 pkgsrc/sysutils/lsof/Makefile
 cvs rdiff -u -r1.85 -r1.86 pkgsrc/sysutils/lsof/distinfo
 cvs rdiff -u -r1.7 -r1.8 pkgsrc/sysutils/lsof/patches/patch-ag

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: pkg-manager->bsiegert
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Tue, 29 Dec 2015 13:05:21 +0000
Responsible-Changed-Why:


State-Changed-From-To: open->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Tue, 29 Dec 2015 13:05:21 +0000
State-Changed-Why:
Committed, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.