From owner-freebsd-ports Tue Aug 20 5:44:28 2002 Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EF5DB37B400 for ; Tue, 20 Aug 2002 05:44:19 -0700 (PDT) Received: from mailg.telia.com (mailg.telia.com [194.22.194.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id A44EE43E42 for ; Tue, 20 Aug 2002 05:44:13 -0700 (PDT) (envelope-from erikt@midgard.homeip.net) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by mailg.telia.com (8.12.5/8.12.5) with ESMTP id g7KCiB8B019001 for ; Tue, 20 Aug 2002 14:44:12 +0200 (CEST) X-Original-Recipient: Received: from falcon.midgard.homeip.net (h62n2fls20o913.telia.com [212.181.163.62]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id OAA09746 for ; Tue, 20 Aug 2002 14:44:11 +0200 (CEST) Received: (qmail 889 invoked by uid 1001); 20 Aug 2002 12:44:09 -0000 Date: Tue, 20 Aug 2002 14:44:09 +0200 From: Erik Trulsson To: Andrew Reilly Cc: Bill Vermillion , stable@FreeBSD.ORG, ports@FreeBSD.ORG Subject: Re: A but in Zoo Message-ID: <20020820124408.GA391@falcon.midgard.homeip.net> Mail-Followup-To: Andrew Reilly , Bill Vermillion , stable@FreeBSD.ORG, ports@FreeBSD.ORG References: <20020814114442.GA77130@wjv.com> <20020814130031.GA58489@falcon.midgard.homeip.net> <1029846175.26839.25.camel@gurney.reilly.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1029846175.26839.25.camel@gurney.reilly.home> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Tue, Aug 20, 2002 at 10:22:55PM +1000, Andrew Reilly wrote: > On Wed, 2002-08-14 at 23:00, Erik Trulsson wrote: > > A quick investigation indicates that this is a bug in zoo. > > It presumably was not exposed on earlier versions of FreeBSD. > > To be more precise the function zootrunc() which can be found at the > > end of the file bsd.c contains a line > > > > seekpos = lseek(fd, 0L, SEEK_CUR); > > > > This should be changed to > > > > seekpos = lseek(fd, (off_t) 0L, SEEK_CUR); > > Rather than changing the source like this, wouldn't it be much better, > more portable and above all neater just to make sure that the prototype > for lseek() was in scope at that point, so that the 0L could be promoted > automatically and correctly by the compiler? (I.e., #include > somewhere above.) There is actually a #include a couple of lines earlier. See below why this doesn't help here. > > In fact, with the prototype in scope, I'd be tempted to change the 2nd > arg from 0L to just 0, and be done with it. Why bother? > > Hmm. Looking at the header files just now, it seems that the > declaration of lseek is conditional on a symbol _LSEEK_DECLARED, which > is defined in both unistd.h and stdio.h (where it is, in turn, > conditional on _ANSI_SOURCE and _POSIX_SOURCE). The real problem is that a few lines above the call to lseek() that is mentioned above the program attempts to declare lseek() itself as off_t lseek(); This apparently overrides the prototype from and thus prevents any automatic promotion to happen. The "correct" fix is thus simply to remove the declaration of lseek(). (Either this fix or my original fix of changing the call to lseek() will work equally well.) Here is a patch to the port to do this: Index: files/patch-aa =================================================================== RCS file: /ncvs/ports/archivers/zoo/files/patch-aa,v retrieving revision 1.4 diff -u -r1.4 patch-aa --- files/patch-aa 24 Apr 1997 02:12:23 -0000 1.4 +++ files/patch-aa 20 Aug 2002 12:35:54 -0000 @@ -65,7 +65,7 @@ /* Truncate a file. */ int zootrunc(f) FILE *f; { -! extern off_t lseek(); +! ! off_t seekpos; int fd = fileno(f); seekpos = lseek(fd, 0L, SEEK_CUR); -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message