Subject: pkg/22934: error in configuration of logfile for net/net-snmp
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 09/24/2003 13:05:40
>Number:         22934
>Category:       pkg
>Synopsis:       error in configuration of logfile for net/net-snmp
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 24 17:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        2003/09/18
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
>Description:

	Unfortunately at the time I submitted the changes in PR#19939 I
	had failed to notice the following line in the configure script:

		if test "$ac_cv_user_prompt_LOGFILE" != "none"; then

	I realized this only after I found a file called "no" with
	growing output in the root directory on systems where I was
	running net-snmp.

	Unfortunately I failed to update the PR in time and then 5.0.8
	and 5.0.9 came along and when I finally got around to upgrading
	my own net-snmp installs I have noticed this problem anew.

	Also note that there should be no default definition for
	NET_SNMP_LOGFILE.  The default should be to use the standard
	syslog facilities.


	Finally also note the wholesale replacement of /usr/local with
	${PREFIX} in the default setting of NET_SNMP_MIBDIRS should not
	have been done.  My suggested default is very explicitly
	intended to include "/usr/local", _NOT_ ${PREFIX}.  The
	substitution must have been done without thinking or testing as
	the result was to include the same directory multiple times.
	The reason for using "/usr/local" is to support use of any
	manually installed MIBs (i.e. MIBs installed outside of pkgsrc).

>How-To-Repeat:

	install net/net-snmp without having NET_SNMP_LOGFILE defined and
	start snmpd.  look for a file /no:

	$ ll /no
	24 400 -rw-r--r--  1 root  wheel  195712 Sep 24 12:40 /no

>Fix:

Index: Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/net/net-snmp/Makefile,v
retrieving revision 1.11
diff -c -c -r1.11 Makefile
*** Makefile	14 Sep 2003 11:58:43 -0000	1.11
--- Makefile	23 Sep 2003 20:30:38 -0000
***************
*** 17,25 ****
  
  NET_SNMP_SYS_CONTACT?=		default_user@contact.domain
  NET_SNMP_SYS_LOCATION?=		defaultlocation
- NET_SNMP_LOGFILE?=		/var/log/snmpd.log
  NET_SNMP_PERSISTENTDIR?=	/var/net-snmp
! NET_SNMP_MIBDIRS?=		\$$HOME/.snmp/mibs:${PREFIX}/share/snmp/mibs:${PREFIX}/lib/tcl/tnm2.1.10/mibs:${PREFIX}/share/snmp/mibs:${PREFIX}/lib/tcl/tnm3.0.0/mibs
  
  USE_BUILDLINK2=		yes
  USE_PKGINSTALL=		yes
--- 17,24 ----
  
  NET_SNMP_SYS_CONTACT?=		default_user@contact.domain
  NET_SNMP_SYS_LOCATION?=		defaultlocation
  NET_SNMP_PERSISTENTDIR?=	/var/net-snmp
! NET_SNMP_MIBDIRS?=		\$$HOME/.snmp/mibs:${PREFIX}/share/snmp/mibs:${PREFIX}/lib/tcl/tnm2.1.10/mibs:/usr/local/share/snmp/mibs:/usr/local/lib/tnm3.0.0/mibs
  
  USE_BUILDLINK2=		yes
  USE_PKGINSTALL=		yes
***************
*** 57,63 ****
  # daemon must be stopped to cycle it properly.  Remember rc.d/snmpd
  # will use '-s' to enable standard syslog logging anyway.
  #
! CONFIGURE_ARGS+=	--without-logfile
  CONFIGURE_ARGS+=	--with-persistent-directory="${NET_SNMP_PERSISTENTDIR}"
  .if !empty(NET_SNMP_MIBDIRS)
  CONFIGURE_ARGS+=	--with-mibdirs="${NET_SNMP_MIBDIRS}"
--- 56,62 ----
  # daemon must be stopped to cycle it properly.  Remember rc.d/snmpd
  # will use '-s' to enable standard syslog logging anyway.
  #
! CONFIGURE_ARGS+=	--with-logfile=none
  CONFIGURE_ARGS+=	--with-persistent-directory="${NET_SNMP_PERSISTENTDIR}"
  .if !empty(NET_SNMP_MIBDIRS)
  CONFIGURE_ARGS+=	--with-mibdirs="${NET_SNMP_MIBDIRS}"
>Release-Note:
>Audit-Trail:
>Unformatted: