From carlj@peak.org  Thu Nov 24 02:54:51 2011
Return-Path: <carlj@peak.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 30FC21065673
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Nov 2011 02:54:51 +0000 (UTC)
	(envelope-from carlj@peak.org)
Received: from redcondor2.peak.org (redcondor2.peak.org [69.59.192.56])
	by mx1.freebsd.org (Postfix) with ESMTP id 0AA758FC14
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Nov 2011 02:54:50 +0000 (UTC)
Received: from zmail-mta01.peak.org ([207.55.16.111])
          by redcondor2.peak.org ({6c724cae-de34-4c5f-b615-3072b86419fa})
          via TCP (outbound) with ESMTP id 20111124024439970
          for <FreeBSD-gnats-submit@freebsd.org>;
          Thu, 24 Nov 2011 02:44:39 +0000
Received: from maple.localnet (unknown [207.55.106.132])
	by zmail-mta01.peak.org (Postfix) with ESMTPSA id 7641C460992
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Nov 2011 18:44:39 -0800 (PST)
Received: from oak.localnet (oak.localnet [IPv6:2001:1938:266::6f:616b])
	by maple.localnet (Postfix) with ESMTP id 25AE261F71
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Nov 2011 18:44:38 -0800 (PST)
Received: from oak.localnet (localhost.localnet [127.0.0.1])
	by oak.localnet (Postfix) with ESMTP id C624FC494
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Nov 2011 18:44:37 -0800 (PST)
Received: (from carlj@localhost)
	by oak.localnet (8.14.4/8.14.4/Submit) id pAO2ibAZ059155;
	Wed, 23 Nov 2011 18:44:37 -0800 (PST)
	(envelope-from carlj)
Message-Id: <201111240244.pAO2ibAZ059155@oak.localnet>
Date: Wed, 23 Nov 2011 18:44:37 -0800 (PST)
From: Carl Johnson <carlj@peak.org>
Reply-To: Carl Johnson <carlj@peak.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: zoo can't modify archives under amd64 [Patch]
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         162804
>Category:       ports
>Synopsis:       archivers/zoo can't modify archives under amd64 [Patch]
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gabor
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 24 03:00:25 UTC 2011
>Closed-Date:    Thu Dec 22 13:12:49 UTC 2011
>Last-Modified:  Fri Mar  9 00:00:44 UTC 2012
>Originator:     Carl Johnson
>Release:        FreeBSD 8.1-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD oak.localnet 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64


	
I have confirmed that this also occurs on FreeBSD 8.2-RELEASE.
>Description:
	
Zoo can't modify any archives that already exist in an amd64 system.
Zoo can create the archive, but any change later generates the message:
    Zoo:  FATAL:  Archive header failed consistency check.
The zoo version is the one in 8.1-RELEASE (zoo-2.10.1_2).


>How-To-Repeat:
	
$ rm -f test.zoo
$ zoo -a test .profile          # test.zoo doesn't exist
Zoo:  .profile --  (38%) added
$ zoo -a test .profile          # test.zoo now exists
Zoo:  FATAL:  Archive header failed consistency check.
$ zoo -l test                   # this will work

Archive test.zoo:
Length    CF  Size Now  Date      Time
--------  --- --------  --------- --------
     813  38%      502  21 Oct 11 15:25:22-1   644 .profile
--------  --- --------  --------- --------
     813  38%      502     1 file
$ pkg_info -Ix zoo
zoo-2.10.1_2        Manipulate archives of files in compressed form

>Fix:

	
The problem seems to be that it uses long calculations (64 bit), but then
compares with stored 32-bit values in the header, which will fail.  The
following patch seems to work, and is basically what I reported to Debian
several years ago (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=335114).
It is based on the already patched contents of the work directory in
/usr/ports/archivers/zoo.  I think it will still work with 32 bit systems, but
I don't have any to check with.

=-=-=-=-=-=-=-=-=-=-  snip diff -u patch below  -=-=-=-=-=-=-=-=-=-=
--- orig/misc.c	2011-11-23 14:56:04.000000000 -0800
+++ misc.c	2011-11-23 17:41:30.000000000 -0800
@@ -177,7 +177,11 @@
 
    frd_zooh (header, zoo_file);
 
+#ifdef __LP64__
+   if ((int)(header->zoo_start + header->zoo_minus) != 0)
+#else
    if ((header->zoo_start + header->zoo_minus) != 0L)
+#endif
       prterror ('f', failed_consistency);
    if (ver_too_high (header))
       prterror ('f', wrong_version, header->major_ver, header->minor_ver);
--- orig/zoodel.c	2011-11-23 14:56:04.000000000 -0800
+++ zoodel.c	2011-11-23 17:41:37.000000000 -0800
@@ -138,7 +138,11 @@
    
    /* read archive header */
    frd_zooh (&zoo_header, zoo_file);
+#ifdef __LP64__
+   if ((int)(zoo_header.zoo_start + zoo_header.zoo_minus) != 0)
+#else
    if ((zoo_header.zoo_start + zoo_header.zoo_minus) != 0L)
+#endif
       prterror ('f', failed_consistency);
    if (ver_too_high (&zoo_header))
       prterror ('f', wrong_version, zoo_header.major_ver, zoo_header.minor_ver);
--- orig/zooext.c	2011-11-23 14:56:04.000000000 -0800
+++ zooext.c	2011-11-23 17:41:47.000000000 -0800
@@ -163,7 +163,11 @@
 } else {
    /* read header */
    frd_zooh (&zoo_header, zoo_file);
+#ifdef __LP64__
+   if ((int)(zoo_header.zoo_start + zoo_header.zoo_minus) != 0) {
+#else
    if ((zoo_header.zoo_start + zoo_header.zoo_minus) != 0L) {
+#endif
       prterror ('w', failed_consistency);
       bad_header++;
 		exit_status = 1;
--- orig/zoopack.c	2011-11-23 14:56:04.000000000 -0800
+++ zoopack.c	2011-11-23 17:41:53.000000000 -0800
@@ -139,7 +139,11 @@
 /* Read the header of the old archive. */
 frd_zooh(&old_zoo_header, zoo_file);
 
+#ifdef __LP64__
+if ((int)(old_zoo_header.zoo_start + old_zoo_header.zoo_minus) != 0) {
+#else
 if ((old_zoo_header.zoo_start + old_zoo_header.zoo_minus) != 0L) {
+#endif
    prterror ('w', failed_consistency);
    ++bad_header;                    /* remember for future error message */
 }
=-=-=-=-=-=-=-=-=-=-  snip diff -u patch above  -=-=-=-=-=-=-=-=-=-=


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->gabor 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Nov 24 05:21:33 UTC 2011 
Responsible-Changed-Why:  
Fix synopsis and assign. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162804 
State-Changed-From-To: open->closed 
State-Changed-By: gabor 
State-Changed-When: Thu Dec 22 13:12:37 UTC 2011 
State-Changed-Why:  
Committed, thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/162804: commit references a PR
Date: Thu, 22 Dec 2011 13:12:48 +0000 (UTC)

 gabor       2011-12-22 13:12:22 UTC
 
   FreeBSD ports repository
 
   Modified files:
     archivers/zoo        Makefile 
     archivers/zoo/files  patch-misc.c patch-zooext.c 
   Added files:
     archivers/zoo/files  patch-ar.h patch-bsd.c patch-makefile 
                          patch-misc2.c patch-nixtime.i 
                          patch-options.h patch-zooadd2.c 
                          patch-zoofns.h patch-zoolist.c 
   Removed files:
     archivers/zoo/files  patch-aa patch-ab 
   Log:
   - Patch zoo to work properly when modifying existing archives on 64-bit
     systems
   - Bump PORTREVISION
   
   PR:             ports/162804
   Submitted by:   Carl Johnson <carlj@peak.org>
   
   Revision  Changes    Path
   1.16      +1 -1      ports/archivers/zoo/Makefile
   1.5       +0 -232    ports/archivers/zoo/files/patch-aa (dead)
   1.3       +0 -68     ports/archivers/zoo/files/patch-ab (dead)
   1.1       +15 -0     ports/archivers/zoo/files/patch-ar.h (new)
   1.1       +46 -0     ports/archivers/zoo/files/patch-bsd.c (new)
   1.1       +41 -0     ports/archivers/zoo/files/patch-makefile (new)
   1.2       +14 -2     ports/archivers/zoo/files/patch-misc.c
   1.1       +17 -0     ports/archivers/zoo/files/patch-misc2.c (new)
   1.1       +12 -0     ports/archivers/zoo/files/patch-nixtime.i (new)
   1.1       +18 -0     ports/archivers/zoo/files/patch-options.h (new)
   1.1       +19 -0     ports/archivers/zoo/files/patch-zooadd2.c (new)
   1.2       +15 -3     ports/archivers/zoo/files/patch-zooext.c
   1.1       +14 -0     ports/archivers/zoo/files/patch-zoofns.h (new)
   1.1       +16 -0     ports/archivers/zoo/files/patch-zoolist.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Carl Johnson <carlj@peak.org>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: freebsd-ports-bugs@FreeBSD.org
Subject: Re: ports/162804: zoo can't modify archives under amd64 [Patch]
Date: Thu, 08 Mar 2012 15:45:03 -0800

 FreeBSD-gnats-submit@FreeBSD.org writes:
 
 > Thank you very much for your problem report.
 > It has the internal identification `ports/162804'.
 > The individual assigned to look at your
 > report is: freebsd-ports-bugs. 
 >
 > You can access the state of your problem report at any time
 > via this link:
 >
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=162804
 >
 >>Category:       ports
 >>Responsible:    freebsd-ports-bugs
 >>Synopsis:       zoo can't modify archives under amd64 [Patch]
 >>Arrival-Date:   Thu Nov 24 03:00:25 UTC 2011
 
 I finally got around to looking into the patched version of
 archivers/zoo and it still doesn't work for amd64.  The problem is that
 the patches for only two of the 4 diffs I supplied were actually
 included. The new version includes only the patches for misc.c and
 zooext.c.  The patches for zoodel.c and zoopack.c were missed somehow.
 -- 
 Carl Johnson		carlj@peak.org
 
>Unformatted:
