Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 149979 - emerge-delta-webrsync: patch to fix false reports of bzip2 incompatibility due to wrong verification path; unnecessary fetches; deprecate use of emerge
Summary: emerge-delta-webrsync: patch to fix false reports of bzip2 incompatibility du...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Zac Medico
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-03 11:23 UTC by kdd
Modified: 2006-10-14 08:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch (*.tar.bz2) to fix wrong verification path and other issues (emerge-delta-webrsync.diff.tar.bz2,704 bytes, patch)
2006-10-03 11:41 UTC, kdd
Details | Diff
Patch as uncompressed textfile emerge-delta-webrsync.diff (emerge-delta-webrsync.diff,1.31 KB, patch)
2006-10-03 12:04 UTC, kdd
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kdd 2006-10-03 11:23:37 UTC
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 "$(dirname ${FILE})"
 		FILE="$(basename ${FILE})"
 	fi
+	### DEBUG snippet BEGIN ###
+		echo "DEBUG INFO: Verifying ${FILE} against ${MD5_LOC} "
+		echo "DEBUG INFO: Current working directory is $(pwd)"
+	###  DEBUG snippet END  ###
 	if eval "$md5_com"; then
 		[ -n "${CUR}" ] && cd "${CUR}"
 		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'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'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 "--" 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'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 "transferring metadata/cache"
-	emerge metadata
+	emerge --metadata
 }
 
 fetch_from_mirrors() {
@@ -410,7 +410,7 @@
 	echo "thus, bailing (sorry)"
 	exit 5
 else
-	if ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
+	if [[ ! -e portage-${final_date}.tar.bz2.umd5sum ]] && ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
 		if ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
 			echo "couldn't grab umd5sum (uncompressed md5sum) for ${final_date}."
 			echo "can't compensate for bzip2 version differences iow."
@@ -462,7 +462,7 @@
 
 echo "verifying generated tarball"
 
-if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar.bz2"; then
+if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/portage-${final_date}.tar.bz2.md5sum"; then
 	if [[ -z $verified ]]; then
 		echo "couldn't verify the generated tarball.  bug, most likely."
 		exit 5




        
Best regards
Klaus
Comment 1 kdd 2006-10-03 11:41:20 UTC
Created attachment 98717 [details, diff]
Patch (*.tar.bz2) 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.
Comment 2 kdd 2006-10-03 12:04:38 UTC
Created attachment 98719 [details, diff]
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)
Comment 3 Petteri Räty (RETIRED) gentoo-dev 2006-10-14 08:40:50 UTC
Fixed in 3.5.1-r1 with permission from zmedico.