On Sun, Apr 12, 2009 at 10:17:51AM -0300, Mario R. Carro wrote:

> Hi, I'm sorry it didn't work:
[...]
>   File "plugins/descriptions.py", line 77, in index
>     self.indexer.index_text_without_positions(version.raw_description)
>   File "/usr/lib/python2.5/site-packages/apt/package.py", line 257, in 
> raw_description
>     return self._records.LongDesc
>   File "/usr/lib/python2.5/site-packages/apt/package.py", line 214, in 
> _records
>     if self.package._pcache._records.Lookup(self._cand.FileList[0]):
> AttributeError: 'NoneType' object has no attribute 'FileList'
> ma...@epox:~/tmp/apt-xapian-index$

Ok, then it *really* sounds like a problem with python-apt.  It
unexpectedly throws on innocent-looking accessor methods when it finds a
package that is removed but not purged, and not in the package database.

I'm attaching a test script that reproduces the problem.  As I see it,
python-apt should rather throw when I get the 'version' object, or
(better) return None for the version, and not give me a broken 'version'
object.

I've reported a bug to python-apt, and I'll set this bug to be blocked
by the python-apt one as soon as I get the bug number.


Ciao,

Enrico

-- 
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enr...@debian.org>
#!/usr/bin/python
# Try to reproduce the python-apt problem behind #523737, #523747 and #521346

import apt, sys

print "Looking for the situation that annoys Enrico..."
cache = apt.Cache(memonly=True)
for pkg in cache:
    ver = pkg.candidate
    if ver is None:
        print >>sys.stderr, name, "has no candidate version"
        sys.exit(0)

    # python-apt should not raise an exception at this point
    try:
        dummy = ver.raw_description
    except:
        print "Enrico is annoyed by the behaviour of python-apt on", pkg.name
        raise

print "You don't have any packages that cause python-apt to annoy Enrico"

Attachment: signature.asc
Description: Digital signature

Reply via email to