All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

Fix erroneous install errors when iterating on an archive (preserving its name but changing its contents).

Review Request #243 - Created March 29, 2011 and submitted

Alain Linden Reviewers
oz.linden, brad.linden, nat_linden
None autobuild
Fixed a bug where an error would be thrown if one tried to install an archive with a filename that matches a cached version but is updated.  One could hit this if they updated the same archive multiple times in a day (like when doing development work).  Now if the cached archive doesn't match the hash, a download will be attempted so only true download errors will result in an exception.

 
Posted (March 29, 2011, 1:18 p.m.)
Couple comments.

First, I think I missed a bet in my small change. Probably there should be a local hash_algorithm var:

hash_algorithm = archive.hash_algorithm or "md5"
if not hash_algorithms.verify_hash(hash_algorithm, cachefile, archive.hash): ...

Second, I'm not enthused about the download_required flag. Three cases, right?

* no such tarball in cache
* tarball in cache by that name has wrong MD5
* tarball in cache by that name is correct

So what about logic like this?

if os.path.exists(cachefile):
    if hash_algorithms.verify_hash(archive.hash_algorithm, cachefile, archive.hash):
        logger.debug("found in cache: " + cachefile)
    else:
        # Cache contains tarball by that name, but wrong hash. Try downloading again.
        common.remove_package(archive.url)

if not os.path.exists(cachefile):
    # download the package to the cache
    ...
Posted (March 29, 2011, 1:32 p.m.)
It looks to me as though we should also try to fix OPEN-34  https://jira.secondlife.com/browse/OPEN-34 as part of this (though the proposed fix might actually do that).

Overall the fix looks pretty good to me.
  1. Alain's logic will fix OPEN-34.