<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>149979</bug_id>
          
          <creation_ts>2006-10-03 11:23 0000</creation_ts>
          <short_desc>emerge-delta-webrsync: patch to fix false reports of bzip2 incompatibility due to wrong verification path; unnecessary fetches; deprecate use of emerge</short_desc>
          <delta_ts>2006-10-14 08:42:20 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Portage Development</product>
          <component>Tools</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>kdd@gmx.net</reporter>
          <assigned_to>zmedico@gentoo.org</assigned_to>
          <cc>betelgeuse@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>kdd@gmx.net</who>
            <bug_when>2006-10-03 11:23:37 0000</bug_when>
            <thetext>Hi,

I noticed that /usr/bin/emerge-delta-webrsync always reports differences
between the distributed file portage-YYYYMMDD.tar.bz2.md5sum from the mirrors
and the checksum of the compressed tarball generated by the script. The script
claims that this is due to differences between bzip2 versions and then creates 
a new *.md5sum file. Comparing this new created checksum file with the file 
from the mirrors the reported checksum is identical and even the verification of 
the new created compressed tarball against the distributed *.gpgsig from the 
mirrors is sucessful.

This false report about a not matching checksum of the compressed tarball is
due to the scipt assuming a wrong current working directory when calling the function
verify_md5_file() without giving the second argument for the location of the
original *.md5sum.

You can check this with the following debug code:

diff -Naur orig/emerge-delta-webrsync debug/emerge-delta-webrsync
--- orig/emerge-delta-webrsync	2006-09-28 10:29:52.000000000 +0000
+++ debug/emerge-delta-webrsync	2006-10-03 13:27:49.000000000 +0000
@@ -253,6 +253,10 @@
 		cd &quot;$(dirname ${FILE})&quot;
 		FILE=&quot;$(basename ${FILE})&quot;
 	fi
+	### DEBUG snippet BEGIN ###
+		echo &quot;DEBUG INFO: Verifying ${FILE} against ${MD5_LOC} &quot;
+		echo &quot;DEBUG INFO: Current working directory is $(pwd)&quot;
+	###  DEBUG snippet END  ###
 	if eval &quot;$md5_com&quot;; then
 		[ -n &quot;${CUR}&quot; ] &amp;&amp; cd &quot;${CUR}&quot;
 		return 0

Then you can see that the working directory changed from ${DISTDIR} to ${TEMPDIR} 
for the creation of the new tarball and the location of the tarball and the 
distributed checksum file differs.


I&apos;ve included a diff for patching the original file emerge-delta-webrsync in the 
version as emerged from me on 2006-09-29 in the package app-portage/emerge-delta-webrsync-3.5.1 
(I only found a cvs/changelog for the ebuild on the web, but not for the app, so I don&apos;t know if 
there are already changes in a development version. The diff is for the file that is installed to /usr/bin/emerge-delta-webrsync).

The patch additionally has changes for 2 different issues:

a.) emerge is called by the original file with a deprecate variant for metadata 
as reported in other bugreport(s). The solution http://bugs.gentoo.org/attachment.cgi?id=93681 
attached to Bug #127021 http://bugs.gentoo.org/show_bug.cgi?id=127021 seems more well thougt out 
as my cosmetic addition of &quot;--&quot; to metadata.

b.) emerge-delta-webrsync is trying to fetch the *.umd5sum for the existing 
base tarball even if the checksum file already exist in the distfiles directory. 
When I&apos;m using this script offline on a machine without a network connection the 
original script fails even if all necessary files are provided in the distfiles directory.
Added a check for the existence of the file before the attempt to fetch the file from the mirrors.



diff -Naur orig/emerge-delta-webrsync modified-r1/emerge-delta-webrsync
--- orig/emerge-delta-webrsync	2006-09-28 10:29:52.000000000 +0000
+++ modified-r1/emerge-delta-webrsync	2006-09-30 12:09:41.000000000 +0000
@@ -218,7 +218,7 @@
 		rm -rf portage
 	fi
 	echo &quot;transferring metadata/cache&quot;
-	emerge metadata
+	emerge --metadata
 }
 
 fetch_from_mirrors() {
@@ -410,7 +410,7 @@
 	echo &quot;thus, bailing (sorry)&quot;
 	exit 5
 else
-	if ! fetch_from_mirrors &quot;/snapshots/portage-${final_date}.tar.bz2.umd5sum&quot; &quot;portage-${final_date}.tar.bz2.umd5sum&quot;; then
+	if [[ ! -e portage-${final_date}.tar.bz2.umd5sum ]] &amp;&amp; ! fetch_from_mirrors &quot;/snapshots/portage-${final_date}.tar.bz2.umd5sum&quot; &quot;portage-${final_date}.tar.bz2.umd5sum&quot;; then
 		if ! fetch_from_mirrors &quot;/snapshots/portage-${final_date}.tar.bz2.umd5sum&quot; &quot;portage-${final_date}.tar.bz2.umd5sum&quot;; then
 			echo &quot;couldn&apos;t grab umd5sum (uncompressed md5sum) for ${final_date}.&quot;
 			echo &quot;can&apos;t compensate for bzip2 version differences iow.&quot;
@@ -462,7 +462,7 @@
 
 echo &quot;verifying generated tarball&quot;
 
-if ! verify_md5_file &quot;${TEMPDIR}/portage-${final_date}.tar.bz2&quot;; then
+if ! verify_md5_file &quot;${TEMPDIR}/portage-${final_date}.tar.bz2&quot; &quot;${DISTDIR}/portage-${final_date}.tar.bz2.md5sum&quot;; then
 	if [[ -z $verified ]]; then
 		echo &quot;couldn&apos;t verify the generated tarball.  bug, most likely.&quot;
 		exit 5




        
Best regards
Klaus</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kdd@gmx.net</who>
            <bug_when>2006-10-03 11:41:20 0000</bug_when>
            <thetext>Created an attachment (id=98717)
Patch to fix wrong verification path and other issues

Added a diff file named emerge-delta-webrsync.diff.tar.bz2 as a patch. The listing of the patch in the description field has a wrong text formatting due to false line feeds. Sorry for that.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kdd@gmx.net</who>
            <bug_when>2006-10-03 12:04:38 0000</bug_when>
            <thetext>Created an attachment (id=98719)
Patch as uncompressed textfile emerge-delta-webrsync.diff

Submitted the unmodified patch as text/plain diff file so everyone can view the diff in a browser (hopefully)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>betelgeuse@gentoo.org</who>
            <bug_when>2006-10-14 08:40:50 0000</bug_when>
            <thetext>Fixed in 3.5.1-r1 with permission from zmedico.</thetext>
          </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>98717</attachid>
            <date>2006-10-03 11:41 0000</date>
            <desc>Patch (*.tar.bz2) to fix wrong verification path and other issues</desc>
            <filename>emerge-delta-webrsync.diff.tar.bz2</filename>
            <type>text/plain</type>
            <data encoding="base64">QlpoOTFBWSZTWQ+ldvsAAdJ/hsowAEB17//4RyNcCv/v3/oAAIAIAAhAAr2x3dLu5TsGRKm9CYU8
mhtKNB6TIMg9QeoDTI0MEElGhBJ4UNGg0AAAAA0HqA9QG1JTxNTU080UB6IAAAAAAAZBJEUxNPRJ
ppkMmjQaAAMgDQADzy3n/gAosCEERmwTmoQiSYQDoctDB1Dp5nYmYc9mbHmZBzts8G7oQvhPM7tJ
VujPVKN8XtmiV1VlPGhfhGk/ZYUOyD2z6ah2G24xYm78/byYhbL4e0ZXTPcNIkKZZp0a5IWb2Hij
5o5Xnxs8QfqKUVyzTg1Bn5Ext8tBQBVBFRSYEYVcXKHq7kgcEtEI2nBgkVVtCOUEIsulN1JiAmfC
5Xt0TZ2/P9wceqha96KEwX7YpnmYXKV0usLNQOAXzuyLEVnJBpycvnZCMenSGIT1liqk+uUtJ3gd
JXl9T7bX5VkGlTJmrKp4umnxgmKmLeIVFBMnGxl/nYOYVS2VnPXKxV4B4l7OZw9aDsJFsY4UjTPg
OI5gt5QMnG4lm6UhiEYKKFjXFEdIu5rIHQh/IIdQi7XfgCeYUoRGFYCivhI00U/tGcUDyuKFkoWB
VJNhFZEGiB8KGXyNTReA3Qg0RCxy9dAMYnNpUPHpZSmCdNJmUHWWJPIsaK2QT04IBJfrmGkYQyJl
UEmYTCtJ5BIzajmmrLDC1Zi0yQ+1GmXbdD+NCgpSLhAnaBjSjSyDXC8nBrNKIWuUEmIp6GlYqQVZ
MUaWTxo4kTVQXyZy6VFqAYEiessqyWSNGJMy2VCQUFbiNExYLhEauw4Kct6uiG59RCa4E6HyIdIi
EGrqWvhxPsUsK9aKad4RJDFReYHYSpDqFMkR1RGiQCIDguVJayoQn0BVRiyY4lLX8IsCuqrcVChW
ClSgaQLIYUJL/F3JFOFCQD6V2+w=
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>98719</attachid>
            <date>2006-10-03 12:04 0000</date>
            <desc>Patch as uncompressed textfile emerge-delta-webrsync.diff</desc>
            <filename>emerge-delta-webrsync.diff</filename>
            <type>text/plain</type>
            <data encoding="base64">ZGlmZiAtTmF1ciBvcmlnL2VtZXJnZS1kZWx0YS13ZWJyc3luYyBtb2RpZmllZC1yMS9lbWVyZ2Ut
ZGVsdGEtd2VicnN5bmMKLS0tIG9yaWcvZW1lcmdlLWRlbHRhLXdlYnJzeW5jCTIwMDYtMDktMjgg
MTA6Mjk6NTIuMDAwMDAwMDAwICswMDAwCisrKyBtb2RpZmllZC1yMS9lbWVyZ2UtZGVsdGEtd2Vi
cnN5bmMJMjAwNi0wOS0zMCAxMjowOTo0MS4wMDAwMDAwMDAgKzAwMDAKQEAgLTIxOCw3ICsyMTgs
NyBAQAogCQlybSAtcmYgcG9ydGFnZQogCWZpCiAJZWNobyAidHJhbnNmZXJyaW5nIG1ldGFkYXRh
L2NhY2hlIgotCWVtZXJnZSBtZXRhZGF0YQorCWVtZXJnZSAtLW1ldGFkYXRhCiB9CiAKIGZldGNo
X2Zyb21fbWlycm9ycygpIHsKQEAgLTQxMCw3ICs0MTAsNyBAQAogCWVjaG8gInRodXMsIGJhaWxp
bmcgKHNvcnJ5KSIKIAlleGl0IDUKIGVsc2UKLQlpZiAhIGZldGNoX2Zyb21fbWlycm9ycyAiL3Nu
YXBzaG90cy9wb3J0YWdlLSR7ZmluYWxfZGF0ZX0udGFyLmJ6Mi51bWQ1c3VtIiAicG9ydG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