Bug 217346

Summary: net-mgmt/net-snmp needs PORTREVISION bump after update to pkg-1.10.0
Product: Ports & Packages Reporter: Olli Hauer <ohauer>
Component: Individual Port(s)Assignee: Ryan Steinmetz <zi>
Status: New ---    
Severity: Affects Some People CC: bapt, jbeich, madpilot, pi, w.schwarzenfeld
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Olli Hauer freebsd_committer 2017-02-25 10:05:54 UTC
It seems snmpd depends on libpkg
After updating pkg to 1.10.0 libpkg.3 is no longer available because it version changed to libpkg.4

Since libpkg.3 is not tracked as dependency poudriere/synth does not rebuild net-snmp without bumping PORTREVISION

# service snmpd restart
Stopping snmpd.
Waiting for PIDS: 22181.
Starting snmpd.
Shared object "libpkg.so.3" not found, required by "snmpd"
/usr/local/etc/rc.d/snmpd: WARNING: failed to start snmpd

# ldd /usr/local/sbin/snmpd
/usr/local/sbin/snmpd:
...
        libelf.so.1 => /usr/lib/libelf.so.1 (0x801db3000)
        libpkg.so.3 => not found (0)
...


# pkg upgrade
Checking for upgrades (157 candidates): 100%
Processing candidates (157 candidates): 100%
The following 4 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        php56-snmp-5.6.30 (needed shared library changed)
        perl5-5.24.1
        net-snmp-5.7.3_11 (needed shared library changed)
        nagios-snmp-plugins-1.3.1 (needed shared library changed)

Number of packages to be reinstalled: 4


# ldd /usr/local/sbin/snmpd
/usr/local/sbin/snmpd:
...
        libelf.so.1 => /usr/lib/libelf.so.1 (0x801db3000)
        libpkg.so.4 => /usr/local/lib/libpkg.so.4 (0x802000000)
...
Comment 1 Jan Beich freebsd_committer 2017-02-25 15:16:04 UTC
net-mgmt/net-snmp also forces consumers to overlink libpkg. Some of the dependencies should probably be limited to static linking to avoid bumping PORTREVISION in each net-snmp consumer in future.

$ net-snmp-config --libs
-L/usr/lib -lm -lkvm -ldevstat -L/lib -L/usr/local/lib -L/usr/local/lib -lnetsnmp -lcrypto -lelf -lpkg -lssp_nonshared

$ pkg rquery '%o %B' | awk '/libpkg/ { print $1 }' | sort -u
net-mgmt/cacti-spine
net-mgmt/lldpd
net-mgmt/mbrowse
net-mgmt/nagios-snmp-plugins
net-mgmt/net-snmp
net-mgmt/php56-snmp
net-mgmt/php70-snmp
net-mgmt/php71-snmp
net-mgmt/sdig
net-mgmt/snmp4nagios
net-mgmt/zabbix2-proxy
net-mgmt/zabbix2-server
net/asterisk11
net/asterisk13
net/ptpd2
security/fwbuilder
security/openvas-libraries
sysutils/cluster-glue
sysutils/nut
sysutils/openhpi
Comment 2 Baptiste Daroussin freebsd_committer 2017-02-25 16:00:37 UTC
The bump has been done on net-snmp, but imho the overlink needs to be fixed, there are no reason other moduels has to be linked to net-snmp
Comment 3 Walter Schwarzenfeld freebsd_triage 2018-02-20 06:17:05 UTC
Makefile

CFLAGS+=        -I${LOCALBASE}/include -I${PKG_PREFIX}/include
==> LDFLAGS+=       -L${LOCALBASE}/lib
CONFIGURE_ENV+= PERLPROG="${PERL}" PSPROG="${PS_CMD}" SED="${SED}"
CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \
                --with-default-snmp-version="${DEFAULT_SNMP_VERSION}" \
                --with-sys-contact="${NET_SNMP_SYS_CONTACT}" \
                --with-sys-location="${NET_SNMP_SYS_LOCATION}" \
                --with-logfile="${NET_SNMP_LOGFILE}" \
                --with-persistent-directory="${NET_SNMP_PERSISTENTDIR}" \
                --with-gnu-ld --without-libwrap \
                --with-ldflags="-lm -lkvm -ldevstat -L${PKG_PREFIX}/lib -L${LOCALBASE}/lib ${LCRYPTO}"
^^^^^^^^^^^^^^^^^^
Comment 4 Ryan Steinmetz freebsd_committer freebsd_triage 2018-02-20 15:01:23 UTC
The link against libpkg is for allowing information about installed packages to be queried via snmp.

The 'ideal' solution (for me) would be to have a little stub library that had the functions in it required to open/query pkgdb (basically just the sqldb bits).  We don't need everything that is available in libpkg.

If such a thing existed, we could then statically link against it.