Comment 0 for bug 127263

Revision history for this message
Will Newton (will-newton) wrote :

The symptom is that if I do gksudo "update-manager -d" I get no option to upgrade and this error:

current dist not found in meta-release file

Looking at the code in:

/usr/lib/python2.5/site-packages/UpdateManager/Core/MetaRelease.py

It seems I had a zero sized METARELEASE_FILE. This was being created by the __init__ method of MetaReleaseCore:

        try:
            open(self.METARELEASE_FILE,"a")
        except IOError, e:
            path = os.path.expanduser("~/.update-manager-core/")
            if not os.path.exists(path):
                os.mkdir(path)
            self.METARELEASE_FILE = os.path.join(path,"meta-release")

Then the download() method checks the mtime of METARELEASE_FILE in order to add an If-Modified-Since header to the http request. The mtime is very recent because we just touched it in __init__. Because of this urllib throws an exception with HTTP 304 Not Modified.

The exception handler then sees the empty METARELEASE_FILE:

        except urllib2.URLError:
            if os.path.exists(self.METARELEASE_FILE):
                self.metarelease_information=open(self.METARELEASE_FILE,"r")

And sets metarelease_information to the newly opened empty file. Later on a parse is attempted on this file which results in no meta-release information matching the current distro.

Fix/workaround:

Taking the last-modified check out works, but probably the best thing to do is to check for a zero sized file at the same time as reading the mtime.