NetBSD Problem Report #45210

From www@NetBSD.org  Tue Aug  2 08:26:36 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id C4AD963BEF4
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  2 Aug 2011 08:26:36 +0000 (UTC)
Message-Id: <20110802082635.EC84263BEEB@www.NetBSD.org>
Date: Tue,  2 Aug 2011 08:26:35 +0000 (UTC)
From: kuehro@gmx.de
Reply-To: kuehro@gmx.de
To: gnats-bugs@NetBSD.org
Subject: bootstrap fails with gcc-4.6 in libfetch (debian wheezy)
X-Send-Pr-Version: www-1.0

>Number:         45210
>Category:       pkg
>Synopsis:       bootstrap fails with gcc-4.6 in libfetch (debian wheezy)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 02 08:30:00 +0000 2011
>Closed-Date:    Sun Oct 09 22:33:34 +0000 2011
>Last-Modified:  Sun Oct 09 22:33:34 +0000 2011
>Originator:     Kai-Uwe Eckhardt
>Release:        
>Organization:
>Environment:
Linux asusi3 2.6.39-2-amd64 #1 SMP Tue Jul 5 02:51:22 UTC 2011 x86_64 GNU/Linux

>Description:
Running env SH=/bin/bash ./bootstrap --abi 64 fails on debian wheezy
while compiling libfetch:

gcc -Wno-error -Wno-format -fno-builtin -Wno-error -Wno-format -fno-builtin  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wreturn-type -Wcast-qual -Wpointer-arith -Wwrite-strings -Wswitch -Wshadow -Werror  -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -DDEF_UMASK=022 -I/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/bzip2 -I/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/zlib -I/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libarchive/libarchive -I/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libfetch -DHAVE_NBCOMPAT_H=1 -I/usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libnbcompat -I. -D_LARGEFILE_SOURCE -D_LARGE_FILES -DFTP_COMBINE_CWDS -c ftp.c
ftp.c: In function 'ftp_closefn':
ftp.c:622:6: error: variable 'r' set but not used [-Werror=unused-but-set-variable]
ftp.c: In function 'ftp_transfer':
ftp.c:680:6: error: variable 'low' set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/bootstrap/work/wrk/pkgtools/pkg_install/work/libfetch
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/pkgtools/pkg_install
*** Error code 1

Stop.
bmake: stopped in /usr/pkgsrc/pkgtools/pkg_install
===> exited with status 1
aborted.
>How-To-Repeat:
bootstrap on debian wheezy and presumably other Linuces like Fedora
which also use gcc-4.6 as default compiler.
gcc -v:  gcc version 4.6.1 (Debian 4.6.1-4) 

>Fix:
bootstrap uses a copy of pkgsrc/net/libfetch, so I used the following
patch in pkgsrc/net/libfetch/files successfully. The fix for r could
be cleaned up by using (void)ftp_chkerr and deleting the declaration
of r, but low is used depending on some macros defined, so +0 is
ugly but necessary.

--- ftp.c.orig	2011-08-02 09:49:59.978654868 +0200
+++ ftp.c	2011-08-02 10:00:34.878654547 +0200
@@ -636,6 +636,7 @@
 	io->dconn = NULL;
 	io->dir = -1;
 	r = ftp_chkerr(io->cconn);
+	r = r + 0; /* fix for -Werror=unused-but-set-variable */
 	fetch_cache_put(io->cconn, ftp_disconnect);
 	free(io);
 	return;
@@ -685,6 +686,7 @@

 	/* check flags */
 	low = CHECK_FLAG('l');
+	low = low + 0; /* fix for -Werror=unused-but-set-variable */
 	pasv = !CHECK_FLAG('a');
 	verbose = CHECK_FLAG('v');


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 04 Aug 2011 23:48:35 +0000
Responsible-Changed-Why:
Over to maintainer.


From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: netbsd@marino.st, Alistair Crooks <agc@pkgsrc.org>
Subject: Re: pkg/45210: bootstrap fails with gcc-4.6 in libfetch (debian
 wheezy)
Date: Sun, 2 Oct 2011 19:08:46 +0200

 Please go ahead and apply this before the freeze.

 Thanks,
  Thomas

 On Sun, Oct 02, 2011 at 05:05:52PM +0200, John Marino wrote:
 > On 10/1/2011 11:13 PM, Alistair Crooks wrote:
 > > 
 > > Indeed - so line 687 should go in #ifdef IPV6_PORTRANGE/#endif guards, too.
 > > 
 > > Or move line 687 closer to where the variable is used, such as around line
 > > 861.
 > > 
 > > Regards,
 > > Alistair
 > 
 > Okay, I revised the patch along these lines.
 > It's probably a moot point anyway; I can't find IPV6_PORTRANGE and
 > friends defined anywhere, so the code between the macros doesn't build
 > in any case.
 > 
 > If Joerg is okay with it, I would be willing to take over PR/45210 and
 > commit this patch once the freeze lifts.
 > 
 > Regards,
 > John
 > 
 > 
 > --- files/ftp.c.orig	2011-10-01 17:08:28.658519066 +0200
 > +++ files/ftp.c	2011-10-02 16:56:35.040791739 +0200
 > @@ -619,7 +619,6 @@
 >  ftp_closefn(void *v)
 >  {
 >  	struct ftpio *io;
 > -	int r;
 > 
 >  	io = (struct ftpio *)v;
 >  	if (io == NULL) {
 > @@ -635,7 +634,7 @@
 >  	fetch_close(io->dconn);
 >  	io->dconn = NULL;
 >  	io->dir = -1;
 > -	r = ftp_chkerr(io->cconn);
 > +	ftp_chkerr(io->cconn);
 >  	fetch_cache_put(io->cconn, ftp_disconnect);
 >  	free(io);
 >  	return;
 > @@ -677,14 +676,13 @@
 >  	const char *bindaddr;
 >  	const char *filename;
 >  	int filenamelen, type;
 > -	int low, pasv, verbose;
 > +	int pasv, verbose;
 >  	int e, sd = -1;
 >  	socklen_t l;
 >  	char *s;
 >  	fetchIO *df;
 > 
 >  	/* check flags */
 > -	low = CHECK_FLAG('l');
 >  	pasv = !CHECK_FLAG('a');
 >  	verbose = CHECK_FLAG('v');
 > 
 > @@ -850,6 +848,7 @@
 >  		uint16_t p;
 >  #if defined(IPV6_PORTRANGE) || defined(IP_PORTRANGE)
 >  		int arg;
 > +		int low = CHECK_FLAG('l');
 >  #endif
 >  		int d;
 >  		char hname[INET6_ADDRSTRLEN];
 > 

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45210: bootstrap fails with gcc-4.6 in libfetch (debian
 wheezy)
Date: Sun, 2 Oct 2011 19:52:29 +0200

 Fine with me.

 Joerg

 On Sun, Oct 02, 2011 at 05:10:06PM +0000, Thomas Klausner wrote:
 > The following reply was made to PR pkg/45210; it has been noted by GNATS.
 > 
 > From: Thomas Klausner <wiz@NetBSD.org>
 > To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
 > Cc: netbsd@marino.st, Alistair Crooks <agc@pkgsrc.org>
 > Subject: Re: pkg/45210: bootstrap fails with gcc-4.6 in libfetch (debian
 >  wheezy)
 > Date: Sun, 2 Oct 2011 19:08:46 +0200
 > 
 >  Please go ahead and apply this before the freeze.
 >  
 >  Thanks,
 >   Thomas
 >  
 >  On Sun, Oct 02, 2011 at 05:05:52PM +0200, John Marino wrote:
 >  > On 10/1/2011 11:13 PM, Alistair Crooks wrote:
 >  > > 
 >  > > Indeed - so line 687 should go in #ifdef IPV6_PORTRANGE/#endif guards, too.
 >  > > 
 >  > > Or move line 687 closer to where the variable is used, such as around line
 >  > > 861.
 >  > > 
 >  > > Regards,
 >  > > Alistair
 >  > 
 >  > Okay, I revised the patch along these lines.
 >  > It's probably a moot point anyway; I can't find IPV6_PORTRANGE and
 >  > friends defined anywhere, so the code between the macros doesn't build
 >  > in any case.
 >  > 
 >  > If Joerg is okay with it, I would be willing to take over PR/45210 and
 >  > commit this patch once the freeze lifts.
 >  > 
 >  > Regards,
 >  > John
 >  > 
 >  > 
 >  > --- files/ftp.c.orig	2011-10-01 17:08:28.658519066 +0200
 >  > +++ files/ftp.c	2011-10-02 16:56:35.040791739 +0200
 >  > @@ -619,7 +619,6 @@
 >  >  ftp_closefn(void *v)
 >  >  {
 >  >  	struct ftpio *io;
 >  > -	int r;
 >  > 
 >  >  	io = (struct ftpio *)v;
 >  >  	if (io == NULL) {
 >  > @@ -635,7 +634,7 @@
 >  >  	fetch_close(io->dconn);
 >  >  	io->dconn = NULL;
 >  >  	io->dir = -1;
 >  > -	r = ftp_chkerr(io->cconn);
 >  > +	ftp_chkerr(io->cconn);
 >  >  	fetch_cache_put(io->cconn, ftp_disconnect);
 >  >  	free(io);
 >  >  	return;
 >  > @@ -677,14 +676,13 @@
 >  >  	const char *bindaddr;
 >  >  	const char *filename;
 >  >  	int filenamelen, type;
 >  > -	int low, pasv, verbose;
 >  > +	int pasv, verbose;
 >  >  	int e, sd = -1;
 >  >  	socklen_t l;
 >  >  	char *s;
 >  >  	fetchIO *df;
 >  > 
 >  >  	/* check flags */
 >  > -	low = CHECK_FLAG('l');
 >  >  	pasv = !CHECK_FLAG('a');
 >  >  	verbose = CHECK_FLAG('v');
 >  > 
 >  > @@ -850,6 +848,7 @@
 >  >  		uint16_t p;
 >  >  #if defined(IPV6_PORTRANGE) || defined(IP_PORTRANGE)
 >  >  		int arg;
 >  > +		int low = CHECK_FLAG('l');
 >  >  #endif
 >  >  		int d;
 >  >  		char hname[INET6_ADDRSTRLEN];
 >  > 
 >  

From: "John Marino" <marino@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/45210 CVS commit: pkgsrc/net/libfetch/files
Date: Sun, 2 Oct 2011 19:15:34 +0000

 Module Name:	pkgsrc
 Committed By:	marino
 Date:		Sun Oct  2 19:15:34 UTC 2011

 Modified Files:
 	pkgsrc/net/libfetch/files: ftp.c

 Log Message:
 PR#45210: Fix pkgsrc bootstrap with gcc 4.6

 Libfetch build failure with gcc 4.6 is due to the a couple of assigned
 variables not getting used.  This patch allows systems like Debian and
 OpenIndiana to bootstrap pkgsrc.


 To generate a diff of this commit:
 cvs rdiff -u -r1.38 -r1.39 pkgsrc/net/libfetch/files/ftp.c

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

State-Changed-From-To: open->feedback
State-Changed-By: marino@NetBSD.org
State-Changed-When: Sun, 02 Oct 2011 19:30:41 +0000
State-Changed-Why:
Requester needs to verify fix works.


From: "Kai-Uwe Eckhardt" <kuehro@gmx.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45210 (bootstrap fails with gcc-4.6 in libfetch (debian
 wheezy))
Date: Thu, 06 Oct 2011 13:37:12 +0200

 > Requester needs to verify fix works.

 Yes, it works. Thanks a lot to everyone involved in fxing it.

 Kai-Uwe
 -- 
 -- 


State-Changed-From-To: feedback->closed
State-Changed-By: marino@NetBSD.org
State-Changed-When: Sun, 09 Oct 2011 22:33:34 +0000
State-Changed-Why:
Fix confirmed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.