readline() on closed filehandle FILES at /usr/sbin/popularity-contest line 104 (not solved yet, but at least we understand) and how popularity-contest works

This is bug [https://bugs.launchpad.net/ubuntu/+source/popularity-contest/+bug/742017 #742017]

The solution is yet to be devised, but at least we know

= How popularity-contest works =

”’popularity-contest”’ is a script that sends a periodic report to Ubuntu (or Debian) about the installed and ”’used”’ packages. At the time of this writing (popularity-contest version 1.51 on Ubuntu 11 / Natty Narwhal), popularity-contest is a Perl script.

How does it work ?

At the heart of the script are two imbricated loops.

This is bug [https://bugs.launchpad.net/ubuntu/+source/popularity-contest/+bug/742017 #742017]

The solution is yet to be devised, but at least we know

= How popularity-contest works =

”’popularity-contest”’ is a script that sends a periodic report to Ubuntu (or Debian) about the installed and ”’used”’ packages. At the time of this writing (popularity-contest version 1.51 on Ubuntu 11 / Natty Narwhal), popularity-contest is a Perl script.

How does it work ?

At the heart of the script are two imbricated loops. The outer one runs through all the installed packages and is fed with something like
dpkg-query –show
The inner loop then takes each package and run through all the installed files of the said package, checking for the ”atime” (the last access time) of each file. If one file has been accessed, said, more recently than the last 30 days, the package is declared “used”.

(Side note: that means that ”’popularity-contest”’ performs a stat on every file installed on your machine via the packaging system, a rather heavy task).

The inner loop get the file list by opening directly the package repository, thus ”’popularity-contest”’ depends on its knowledge of the structure of the repository. Traditionally, the repository is in
/var/lib/dpkg/info
where lives (among others) a file .list, with the list of the files from the package.

== This is were things go awry ==

The point is that some packages are architecture-dependent: the list of files depends on your processor, for example. For those packages, the name of the file list is not .list, but : < architecture > .list.

For example, in my case, the list of files of the base package for gcc v4.5 is called gcc-4.5-base”’:386”’.list. ”’popularity-contest”’ looks fot gcc-4.5-base.list and doesn’t get it right (for a reason unknown to me at the time of this writing), hence the error in the log.