Thursday, 16 May 2013

Re: Mysterious Python pyc file corruption problems

Well, that sucks. These two cases break my hypothesis.

>>> I've found one bug where the interpreter is python3.3:
>>>
>>> http://launchpad.net/bugs/1178599

So, let's assume that the traceback is accurate. It's telling us that Python
3.3 is unable to import optparse, which is a stdlib module and so should have
gotten its pyc written when python3.3-minimal was installed. In the bug, I've
asked to have /usr/lib/python3.3/__pycache__/optparse.cpython-33.pyc
attached. If nothing has changed since the original bug report, and that *is*
the corrupt file, we should be able to inspect it and at least verify the
corruption.

>>> This looks to be a fresh install of Raring so the apport data seems
>>> trustworthy. (There are some apport issues with delayed reporting and
>>> distribution upgrades.) I'll be doing a full search of Launchpad bugs
>>> shortly.
>>
>> And http://launchpad.net/bugs/1107175

This one is trickier, since the failing import is:

File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, re, pwd, grp, os

All of these are in python3.3-minimal, and all but pwd and grp are Python
modules (those latter two are extension modules, so wouldn't have any pyc
files to get corrupted). I'll ask the OP to attach the relevant .pyc files
for verification.

>would it be possible to find out for each bug report which file seems to be
>corrupt, and which package it belongs too? To see if this breakage is limited
>to certain packages. So far for the two bugs mentioned it's python3.3-minimal,
>and python3-apport.

I wonder if we can instrument apport to catch these types of errors
specifically, analyze the failing import lines, and chase them back to the pyc
files that appear to be the culprits?

It's not just stdlib modules getting corrupted though. Maybe py_compile or
some other part of the byte-compile-after-installation toolchain is
misbehaving under some situations? But the Python 3.3 cases lead away from
the race-condition-on-writing-pyc file theory.

-Barry

--
ubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel