Date: Wed, 23 Nov 2011 18:44:37 -0800 (PST) From: Carl Johnson <carlj@peak.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/162804: zoo can't modify archives under amd64 [Patch] Message-ID: <201111240244.pAO2ibAZ059155@oak.localnet> Resent-Message-ID: <201111240300.pAO30Pk3069686@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 162804 >Category: ports >Synopsis: zoo can't modify archives under amd64 [Patch] >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 24 03:00:25 UTC 2011 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111240244.pAO2ibAZ059155>