[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#982281: reportbug gets source package name wrong



Hi,

(Disclaimer: I am not a pythonista, but a libapt c++ dev)

(Disclaimer 2: Changed to cloned bugreport 982281 as its the one against
 reportbug, even if the request message didn't end up there so as not to
 derail the udeb thread further. Subject changed accordingly.)


On Mon, Feb 08, 2021 at 01:24:36PM +0100, Nis Martensen wrote:
> What happens here is that the binary package lookup in the apt cache fails (probably because this is an udeb package), but the SourceRecords().lookup() with the given package name succeeds. Shouldn't this only succeed if there is a source package with this name? The documentation does not mention binary packages in the section on SourceRecords().lookup().

The documentation does not seem to indicate this, but in the bindings
code python/pkgsrcrecords.cc:175 you can read "Records->Find(Name,
false)". The 'false' is setting a parameter SrcOnly (which is optional
and always defaulted to false since the dawn of time… 1999).

The parameter controls as the name might suggest if the lookup happens
only on the source package name field (true) or if additionally the
binaries field is inspected for inclusion of the name (false).

I do not see a way in the python code to control this parameter,
but I haven't looked too closely either.


> I'm wondering whether reportbug is using apt's python bindings incorrectly. What would be the correct way to obtain the source package name of an udeb package using python3-apt?

I presume something like:

	srcrecords = apt.apt_pkg.SourceRecords()
	if srcrecords.lookup(package):
		return srcrecords.package

Would be more correct as not finding the source package name of an udeb
can't really be the intention of the code (which would be the result if
we somehow managed to set the parameter to true).

It's not too common the first try block doesn't find the name though so
it likely is just a matter of nobody noticing before…
(how often is someone really reporting a bug against a binary package not
 build for the architecture or sources.list components of the reporters
 machine).


Best regards

David Kalnischkies

Attachment: signature.asc
Description: PGP signature


Reply to: