Bug 132436 - [PATCH] net/tcpdump: missing conditional dependancy on libsmi
Summary: [PATCH] net/tcpdump: missing conditional dependancy on libsmi
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: Bruce M Simpson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-08 22:50 UTC by Craig Leres
Modified: 2009-04-24 14:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer freebsd_triage 2009-03-08 22:50:02 UTC
	If libsmi is present, tcpdump will detect it via autoconf
	and link against it. But since no dependency is registered,
	it's possible to break tcpdump by later deinstalling libsmi.

Fix: Add a package dependency on libsmi if it was installed when
	tcpdump was built (see attached patch).

--------------020108090304050705060902
Content-Type: text/plain;
 name="patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch.txt"



--------------020108090304050705060902
Content-Type: application/octet-stream;
 name="patch.txt.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="patch.txt.sig"

iEYEABECAAYFAkm0Sx0ACgkQWxlAhAje3JsCmgCaAjUWx/r/YRvq84qF2UoYf6To7foAnivk
P06rBeB8tSw6fzhWK9Qqfdcg
--------------020108090304050705060902----Xr3BLgCRc9qy0Q1NmDhe5Dr27oItQJIL232GirVZtDuSPij7
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- Makefile-	Sun Aug  5 04:27:31 2007
+++ Makefile	Sun Mar  8 15:25:40 2009
@@ -22,6 +22,13 @@
 BUILD_DEPENDS=	${LOCALBASE}/lib/libpcap.a:${PORTSDIR}/net/libpcap
 .endif
 
+# tcpdump links against libsmi if present
+HAVE_LIBSMI!=	pkg_info -E libsmi-* || true
+
+.if !empty(HAVE_LIBSMI)
+LIB_DEPENDS+=	libsmi:net-mgmt/libsmi
+.endif
+
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
 MAN1=		tcpdump.1
How-To-Repeat: 	Build and install libsmi; build and install tcpdump:

	    % ldd /usr/sbin/tcpdump
	    /usr/sbin/tcpdump:
		    libcrypto.so.5 => /lib/libcrypto.so.5 (0x280f9000)
		    libpcap.so.2 => /usr/lib/libpcap.so.2 (0x28252000)
		    libsmi.so.2 => /usr/local/lib/libsmi.so.2 (0x2827e000)
		    libc.so.7 => /lib/libc.so.7 (0x282d2000)

	Uninstall libsmi and notice that tcpdump no longer works:

	    % pkg_delete libsmi-\*
	    % ldd /usr/sbin/tcpdump
	    /usr/sbin/tcpdump:
		    libcrypto.so.5 => /lib/libcrypto.so.5 (0x280f9000)
		    libpcap.so.2 => /usr/lib/libpcap.so.2 (0x28252000)
		    libsmi.so.2 => not found (0x0)
		    libc.so.7 => /lib/libc.so.7 (0x2827e000)
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-03-09 00:39:01 UTC
Responsible Changed
From-To: gnats-admin->bms

ports PR.
Comment 2 Bruce M Simpson 2009-04-06 12:40:18 UTC
Hi Craig,

Sorry for taking so long to look at this.

Can you kick this back upstream to the tcpdump.org developers?

I'm concerned that whilst the intent of your patch is clear, I
can't commit it as-is without possibly breaking things in cross-build
or jailed environments.

Whilst tcpdump is careful not to try to enable libsmi when explictly
cross built via the usual GNU mechanisms, FreeBSD ports currently don't
use this feature, and generally cross building is only possible in
a jailed or tinderboxed environment.

The "right fix" would be for tcpdump's configure.in to explicitly allow
libsmi use to be turned on or off e.g. with a switch say --enable-libsmi.

I don't see a fix for this in tcpdump 4.0.0.

Rui Paulo (Cc'd) recently merged libpcap/tcpdump 1.0.0/4.0.0
to FreeBSD HEAD in SVN so he might be aware of issues like this.

thanks,
BMS
Comment 3 Rui Paulo freebsd_committer freebsd_triage 2009-04-06 17:14:50 UTC
On 6 Apr 2009, at 12:40, Bruce M Simpson wrote:

> Hi Craig,
>
> Sorry for taking so long to look at this.
>
> Can you kick this back upstream to the tcpdump.org developers?
>
> I'm concerned that whilst the intent of your patch is clear, I
> can't commit it as-is without possibly breaking things in cross-build
> or jailed environments.
>
> Whilst tcpdump is careful not to try to enable libsmi when explictly
> cross built via the usual GNU mechanisms, FreeBSD ports currently  
> don't
> use this feature, and generally cross building is only possible in
> a jailed or tinderboxed environment.
>
> The "right fix" would be for tcpdump's configure.in to explicitly  
> allow
> libsmi use to be turned on or off e.g. with a switch say --enable- 
> libsmi.
>
> I don't see a fix for this in tcpdump 4.0.0.
>
> Rui Paulo (Cc'd) recently merged libpcap/tcpdump 1.0.0/4.0.0
> to FreeBSD HEAD in SVN so he might be aware of issues like this.

The machine which I used to import tcpdump didn't have libsmi  
installed, so I'm not aware of this issue.


--
Rui Paulo
Comment 4 Bruce M Simpson freebsd_committer freebsd_triage 2009-04-24 14:44:57 UTC
State Changed
From-To: open->closed

libsmi dependency is now unconditional (fixed in CVS)