From jdc@koitsu.dyndns.org  Mon Jul 12 16:48:39 2010
Return-Path: <jdc@koitsu.dyndns.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6E451065672
	for <freebsd-gnats-submit@freebsd.org>; Mon, 12 Jul 2010 16:48:39 +0000 (UTC)
	(envelope-from jdc@koitsu.dyndns.org)
Received: from QMTA11.westchester.pa.mail.comcast.net (qmta11.westchester.pa.mail.comcast.net [76.96.59.211])
	by mx1.freebsd.org (Postfix) with ESMTP id 8677A8FC14
	for <freebsd-gnats-submit@freebsd.org>; Mon, 12 Jul 2010 16:48:39 +0000 (UTC)
Received: from omta21.westchester.pa.mail.comcast.net ([76.96.62.72])
	by QMTA11.westchester.pa.mail.comcast.net with comcast
	id h1Zd1e0031ZXKqc5B4ofyM; Mon, 12 Jul 2010 16:48:39 +0000
Received: from koitsu.dyndns.org ([98.248.41.155])
	by omta21.westchester.pa.mail.comcast.net with comcast
	id h4oe1e0043LrwQ23h4oejp; Mon, 12 Jul 2010 16:48:39 +0000
Received: by icarus.home.lan (Postfix, from userid 1000)
	id 231759B425; Mon, 12 Jul 2010 09:48:37 -0700 (PDT)
Message-Id: <20100712164837.231759B425@icarus.home.lan>
Date: Mon, 12 Jul 2010 09:48:37 -0700 (PDT)
From: Jeremy Chadwick <freebsd@jdc.parodius.com>
Reply-To: Jeremy Chadwick <freebsd@jdc.parodius.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: R.E.Wolff@BitWizard.nl
Subject: net/mtr 0.79 -- RES_INIT macro conflict and unused variables on systems w/out IPv6
X-Send-Pr-Version: 3.113
X-GNATS-Notify: sunpoet@sunpoet.net

>Number:         148524
>Category:       ports
>Synopsis:       net/mtr 0.79 -- RES_INIT macro conflict and unused variables on systems w/out IPv6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 12 16:50:02 UTC 2010
>Closed-Date:    Thu Jul 22 03:39:27 UTC 2010
>Last-Modified:  Thu Jul 22 03:39:27 UTC 2010
>Originator:     Jeremy Chadwick
>Release:        FreeBSD 8.1-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD icarus.home.lan 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #0: Tue Jun 8 05:01:22 PDT 2010 root@icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_8_amd64 amd64
>Description:
	The author of mtr appears to have chosen a name for a macro
	which already exists on FreeBSD:

if cc -DHAVE_CONFIG_H -I. -I. -I.	-O2 -pipe -march=nocona -fno-strict-aliasing -Wall -Wno-pointer-sign -MT dns.o -MD -MP -MF ".deps/dns.Tpo" -c -o dns.o dns.c; \
	then mv -f ".deps/dns.Tpo" ".deps/dns.Po"; else rm -f ".deps/dns.Tpo"; exit 1; fi
dns.c:313:1: warning: "RES_INIT" redefined
In file included from dns.c:38:
/usr/include/resolv.h:230:1: warning: this is the location of the previous definition

	The difference is pretty severe however, meaning this could
	bite us later:

# cd /usr/ports/net/mtr
# grep -r RES_INIT .
./work/mtr-0.79/dns.c:#define RES_INIT() res_ninit(&myres);
./work/mtr-0.79/dns.c:#define RES_INIT() res_init();
./work/mtr-0.79/dns.c:  RES_INIT();
icarus# grep RES_INIT /usr/include/resolv.h
#define RES_INIT        0x00000001      /*%< address initialized */

	One's a macro to either res_init() or res_ninit(), while the other
	is a bitfield for resolver options.  Ouch.

	Next we have an "unused variable" warning which only happens if the
	software is built without IPv6 support:

if cc -DHAVE_CONFIG_H -I. -I. -I.	-O2 -pipe -march=nocona -fno-strict-aliasing -Wall -Wno-pointer-sign -MT net.o -MD -MP -MF ".deps/net.Tpo" -c -o net.o net.c; \
	then mv -f ".deps/net.Tpo" ".deps/net.Po"; else rm -f ".deps/net.Tpo"; exit 1; fi
net.c: In function 'net_send_query':
net.c:301: warning: unused variable 'offset'

	This one is easy to fix -- there's a missing #ifdef and #endif.
>How-To-Repeat:
	Attempt to build net/mtr 0.79, particularly on a system with WITHOUT_IPV6
	defined in make.conf (or maybe WITHOUT_INET6 in src.conf).
>Fix:
	The easiest way to deal with this is to rename mtr's macro to
	something like MY_RES_INIT.  As far as the unused variables goes,
	adding the necessary #ifdef/#endif should be sufficient.

	Below are two patch that should do both things.  Drop 'em in files/.

	These issues should be reported upstream to the author to be
	fixed in the official source.  I've CC'd him here.


--- dns.c.orig	2010-06-06 23:58:23.000000000 -0700
+++ dns.c	2010-07-12 09:40:15.000000000 -0700
@@ -310,12 +310,12 @@
 int use_dns = 1;
 
 #ifdef res_ninit
-#define RES_INIT() res_ninit(&myres);
+#define MY_RES_INIT() res_ninit(&myres);
 #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
     res_nmkquery(&myres, a, b, c, d, e, f, g, h, i)
 struct __res_state myres;
 #else
-#define RES_INIT() res_init();
+#define MY_RES_INIT() res_init();
 #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
     res_mkquery(a, b, c, d, e, f, g, h, i)
 #define myres _res
@@ -495,7 +495,7 @@
   int option,i;
 
   if (!dns) return;
-  RES_INIT();
+  MY_RES_INIT();
   if (!myres.nscount) {
     fprintf(stderr,"No nameservers defined.\n");
     exit(-1);



--- net.c.orig	2010-06-06 23:58:25.000000000 -0700
+++ net.c	2010-07-12 09:45:08.000000000 -0700
@@ -297,8 +297,10 @@
 
   ttl = index + 1;
 
+#ifdef ENABLE_IPV6
   /* offset for ipv6 checksum calculation */
   int offset = 6;
+#endif
 
   if ( packetsize < MINPACKET ) packetsize = MINPACKET;
   if ( packetsize > MAXPACKET ) packetsize = MAXPACKET;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Mon Jul 12 16:50:15 UTC 2010 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148524 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: sunpoet@sunpoet.net
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/148524: net/mtr 0.79 -- RES_INIT macro conflict and unused variables on systems w/out IPv6
Date: Mon, 12 Jul 2010 16:50:11 UT

 Maintainer of net/mtr,
 
 Please note that PR ports/148524 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/148524
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Sunpoet Po-Chuan Hsieh <sunpoet@sunpoet.net>
To: bug-followup@FreeBSD.org, Jeremy Chadwick <freebsd@jdc.parodius.com>,
	Edwin Groothuis <edwin@FreeBSD.org>
Cc:  
Subject: Re: ports/148524: net/mtr 0.79 -- RES_INIT macro conflict and
 unused variables on systems w/out IPv6
Date: Tue, 13 Jul 2010 01:58:33 +0800

 Hi,
 
 The updated patch is attached.
 Thanks for Jeremy's notification to the author. :)
 
 Regards,
 Sunpoet
 
 --- mtr-0.79.patch begins here ---
 diff -ruN --exclude=CVS /usr/ports/net/mtr/Makefile /usr/ports/sunpoet/mtr/Makefile
 --- /usr/ports/net/mtr/Makefile	2010-07-12 17:57:40.000000000 +0800
 +++ /usr/ports/sunpoet/mtr/Makefile	2010-07-13 01:55:54.000000000 +0800
 @@ -7,6 +7,7 @@
  
  PORTNAME=	mtr
  PORTVERSION=	0.79
 +PORTREVISION=	1
  CATEGORIES=	net ipv6
  MASTER_SITES=	ftp://ftp.bitwizard.nl/mtr/ \
  		http://mirrors.evolva.ro/util/mtr/ \
 diff -ruN --exclude=CVS /usr/ports/net/mtr/files/patch-dns.c /usr/ports/sunpoet/mtr/files/patch-dns.c
 --- /usr/ports/net/mtr/files/patch-dns.c	1970-01-01 08:00:00.000000000 +0800
 +++ /usr/ports/sunpoet/mtr/files/patch-dns.c	2010-07-13 01:25:41.000000000 +0800
 @@ -0,0 +1,26 @@
 +--- dns.c.orig	2010-06-07 14:58:23.000000000 +0800
 ++++ dns.c	2010-07-13 01:25:19.000000000 +0800
 +@@ -310,12 +310,12 @@
 + int use_dns = 1;
 + 
 + #ifdef res_ninit
 +-#define RES_INIT() res_ninit(&myres);
 ++#define MTR_RES_INIT() res_ninit(&myres);
 + #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
 +     res_nmkquery(&myres, a, b, c, d, e, f, g, h, i)
 + struct __res_state myres;
 + #else
 +-#define RES_INIT() res_init();
 ++#define MTR_RES_INIT() res_init();
 + #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
 +     res_mkquery(a, b, c, d, e, f, g, h, i)
 + #define myres _res
 +@@ -495,7 +495,7 @@
 +   int option,i;
 + 
 +   if (!dns) return;
 +-  RES_INIT();
 ++  MTR_RES_INIT();
 +   if (!myres.nscount) {
 +     fprintf(stderr,"No nameservers defined.\n");
 +     exit(-1);
 diff -ruN --exclude=CVS /usr/ports/net/mtr/files/patch-net.c /usr/ports/sunpoet/mtr/files/patch-net.c
 --- /usr/ports/net/mtr/files/patch-net.c	1970-01-01 08:00:00.000000000 +0800
 +++ /usr/ports/sunpoet/mtr/files/patch-net.c	2010-07-13 01:26:54.000000000 +0800
 @@ -0,0 +1,13 @@
 +--- net.c.orig	2010-06-07 14:58:25.000000000 +0800
 ++++ net.c	2010-07-13 01:26:43.000000000 +0800
 +@@ -297,8 +297,10 @@
 + 
 +   ttl = index + 1;
 + 
 ++#ifdef ENABLE_IPV6
 +   /* offset for ipv6 checksum calculation */
 +   int offset = 6;
 ++#endif
 + 
 +   if ( packetsize < MINPACKET ) packetsize = MINPACKET;
 +   if ( packetsize > MAXPACKET ) packetsize = MAXPACKET;
 --- mtr-0.79.patch ends here ---

From: Jeremy Chadwick <freebsd@jdc.parodius.com>
To: Sunpoet Po-Chuan Hsieh <sunpoet@sunpoet.net>
Cc: bug-followup@FreeBSD.org, Edwin Groothuis <edwin@FreeBSD.org>
Subject: Re: ports/148524: net/mtr 0.79 -- RES_INIT macro conflict and
 unused variables on systems w/out IPv6
Date: Tue, 13 Jul 2010 02:10:01 -0700

 On Tue, Jul 13, 2010 at 01:58:33AM +0800, Sunpoet Po-Chuan Hsieh wrote:
 > Hi,
 > 
 > The updated patch is attached.
 > Thanks for Jeremy's notification to the author. :)
 > 
 > Regards,
 > Sunpoet
 > 
 > --- mtr-0.79.patch begins here ---
 > diff -ruN --exclude=CVS /usr/ports/net/mtr/Makefile /usr/ports/sunpoet/mtr/Makefile
 > --- /usr/ports/net/mtr/Makefile	2010-07-12 17:57:40.000000000 +0800
 > +++ /usr/ports/sunpoet/mtr/Makefile	2010-07-13 01:55:54.000000000 +0800
 > @@ -7,6 +7,7 @@
 >  
 >  PORTNAME=	mtr
 >  PORTVERSION=	0.79
 > +PORTREVISION=	1
 >  CATEGORIES=	net ipv6
 >  MASTER_SITES=	ftp://ftp.bitwizard.nl/mtr/ \
 >  		http://mirrors.evolva.ro/util/mtr/ \
 > diff -ruN --exclude=CVS /usr/ports/net/mtr/files/patch-dns.c /usr/ports/sunpoet/mtr/files/patch-dns.c
 > --- /usr/ports/net/mtr/files/patch-dns.c	1970-01-01 08:00:00.000000000 +0800
 > +++ /usr/ports/sunpoet/mtr/files/patch-dns.c	2010-07-13 01:25:41.000000000 +0800
 > @@ -0,0 +1,26 @@
 > +--- dns.c.orig	2010-06-07 14:58:23.000000000 +0800
 > ++++ dns.c	2010-07-13 01:25:19.000000000 +0800
 > +@@ -310,12 +310,12 @@
 > + int use_dns = 1;
 > + 
 > + #ifdef res_ninit
 > +-#define RES_INIT() res_ninit(&myres);
 > ++#define MTR_RES_INIT() res_ninit(&myres);
 > + #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
 > +     res_nmkquery(&myres, a, b, c, d, e, f, g, h, i)
 > + struct __res_state myres;
 > + #else
 > +-#define RES_INIT() res_init();
 > ++#define MTR_RES_INIT() res_init();
 > + #define RES_MKQUERY(a, b, c, d, e, f, g, h, i) \
 > +     res_mkquery(a, b, c, d, e, f, g, h, i)
 > + #define myres _res
 > +@@ -495,7 +495,7 @@
 > +   int option,i;
 > + 
 > +   if (!dns) return;
 > +-  RES_INIT();
 > ++  MTR_RES_INIT();
 > +   if (!myres.nscount) {
 > +     fprintf(stderr,"No nameservers defined.\n");
 > +     exit(-1);
 > diff -ruN --exclude=CVS /usr/ports/net/mtr/files/patch-net.c /usr/ports/sunpoet/mtr/files/patch-net.c
 > --- /usr/ports/net/mtr/files/patch-net.c	1970-01-01 08:00:00.000000000 +0800
 > +++ /usr/ports/sunpoet/mtr/files/patch-net.c	2010-07-13 01:26:54.000000000 +0800
 > @@ -0,0 +1,13 @@
 > +--- net.c.orig	2010-06-07 14:58:25.000000000 +0800
 > ++++ net.c	2010-07-13 01:26:43.000000000 +0800
 > +@@ -297,8 +297,10 @@
 > + 
 > +   ttl = index + 1;
 > + 
 > ++#ifdef ENABLE_IPV6
 > +   /* offset for ipv6 checksum calculation */
 > +   int offset = 6;
 > ++#endif
 > + 
 > +   if ( packetsize < MINPACKET ) packetsize = MINPACKET;
 > +   if ( packetsize > MAXPACKET ) packetsize = MAXPACKET;
 > --- mtr-0.79.patch ends here ---
 
 I should point out that the author of mtr got in touch with me.  He's
 released mtr 0.80 which includes the above fixes, in addition to some
 others.
 
 Probably best to just update the port to 0.80 at this point, then
 there's no need for the patches.
 
 Thanks!
 
 -- 
 | Jeremy Chadwick                                   jdc@parodius.com |
 | Parodius Networking                       http://www.parodius.com/ |
 | UNIX Systems Administrator                  Mountain View, CA, USA |
 | Making life hard for others since 1977.              PGP: 4BD6C0CB |
 
State-Changed-From-To: feedback->closed 
State-Changed-By: sahil 
State-Changed-When: Thu Jul 22 03:39:26 UTC 2010 
State-Changed-Why:  
See ports/148539. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148524 
>Unformatted:
