Bug in apt 0.5.15lorg2 using rpm 4.4.5

"Herton Krzesinski" <[email protected]> Sun, 5 Mar 2006 18:42:24 -0300
Newsgroups gmane.linux.conectiva.apt-rpm
Message-ID <[email protected]>
------=_Part_3313_31455108.1141594944038
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi, I saw that Panu is continuing work for apt-rpm, In using his new
apt a friend (Andreas Hasenack) found a bug in apt-get build-dep,
basically an apt-get build-dep <some file>.src.rpm doesn't work, it
fail on rpm internal dependencies. Looking trough the code I found the
problem and made a patch, I'm attaching it here. Here is the
description of internals about the patch:

There is an error inside new apt-rpm 0.5.15lorg2 inside the function=20
rpmSrcRecordParser::BuildDepends at file rpmsrcrecords.cc, as the
function was failing to detect/pass the internal rpm dependencies.
Patch details: If you want to check the results after rpmdsSearch(*,
ds) with rpmdsResult, before Search you must use the function
rpmdsSetResult (eg.: rpmdsSetResult(ds, 0)) to alloc memory  for
ds->Result, otherwise rpmdsSearch will not be able to store
information in ds->Result.

The fix could be different of course. We could avoid to use
rpmdsResult, just checking what rpmdsSearch returned (a value >=3D0 the
key was found, like is used just lines above with getconf for
example). Or if you consider the problem of ds->Result not being
allocated a bug of rpm, then rpmdsSingle must alloc memory for it. I
don't know if there is a right thing to do here or if the problem is
really of apt, but I decided to patch apt-rpm and this fixes the issue
of build-dep not working.

[]'s
Herton.

------=_Part_3313_31455108.1141594944038
Content-Type: application/octet-stream; 
	name=apt-0.5.15lorg2-builddep_srcrpm.patch
Content-Transfer-Encoding: 7bit
X-Attachment-Id: f_ekfw2pko
Content-Disposition: attachment;
	filename="apt-0.5.15lorg2-builddep_srcrpm.patch"

--- apt-0.5.15lorg2/apt-pkg/rpm/rpmsrcrecords.cc.orig	2006-03-05 17:54:18.000000000 -0300
+++ apt-0.5.15lorg2/apt-pkg/rpm/rpmsrcrecords.cc	2006-03-05 17:55:24.000000000 -0300
@@ -455,6 +455,7 @@
 	    rpmds rpmlibProv = NULL;
 	    rpmds ds = rpmdsSingle(RPMTAG_PROVIDENAME,
 				   namel[i], verl?verl[i]:NULL, flagl[i]);
+	    rpmdsSetResult(ds, 0);
 	    rpmdsRpmlib(&rpmlibProv, NULL);
 	    rpmdsSearch(rpmlibProv, ds);
 	    int res = rpmdsResult(ds);

------=_Part_3313_31455108.1141594944038
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
apt-rpm mailing list
[email protected]
http://distro2.conectiva.com.br/mailman/listinfo/apt-rpm

------=_Part_3313_31455108.1141594944038--