Package: unattended-upgrades Version: 0.39debian1 Severity: important Tags: patch
If a package can't be upgraded because it asks for a configuration file change, unattended-upgrades only prints a warning to the log, but does not include this information in the email. Information about packages that were kept back (pkgs_kept_back) is only sent if at least one package could be updated (pkgs_to_upgrade), otherwise the script exits without sending an email. The attached patch should fix these problems. The following changes were necessary: - pkgs_kept_back is now a list of strings instead of a list of apt_pkg objects. This even reduces overhead because only the names are used. - If a package is kept back because of a conffile change, its name is appended to pkgs_kept_back. - The script only exits early if there is nothing to update _and_ there are no pkgs_kept_back to report by email. The fix is only for unstable (and perhaps testing), but not for stable, because the stable version does not report any packages kept back. Thanks Max Gaukler
--- /tmp/usr/bin/unattended-upgrade 2009-03-03 08:48:55.000000000 +0100 +++ unattended-upgrade 2009-05-01 17:38:10.000000000 +0200 @@ -198,12 +198,12 @@ else: logging.debug("sanity check failed") rewind_cache(cache, pkgs_to_upgrade) - pkgs_kept_back.append(pkg) + pkgs_kept_back.append(pkg.name) except SystemError, e: # can't upgrade logging.warning(_("package '%s' upgradable but fails to be marked for upgrade (%s)") % e) rewind_cache(cache, pkgs_to_ugprade) - pkgs_kept_back.append(pkg) + pkgs_kept_back.append(pkg.name) pkgs = "\n".join([pkg.name for pkg in pkgs_to_upgrade]) @@ -244,6 +244,7 @@ # some other package again! logging.warning(_("Package '%s' has conffile prompt and needs to be upgraded manually") % pkgname_from_deb(item.DestFile)) blacklisted_pkgs.append(pkgname_from_deb(item.DestFile)) + pkgs_kept_back.append(pkgname_from_deb(item.DestFile)) # redo the selection about the packages to upgrade based on the new @@ -270,8 +271,8 @@ logging.debug("InstCount=%i DelCount=%i BrokenCout=%i" % (cache._depcache.InstCount, cache._depcache.DelCount, cache._depcache.BrokenCount)) - # check what we have - if len(pkgs_to_upgrade) == 0: + # exit if there is nothing to do and nothing to report + if (len(pkgs_to_upgrade) == 0) and (len(pkgs_kept_back) == 0): logging.info(_("No packages found that can be upgraded unattended")) sys.exit(0) @@ -338,7 +339,7 @@ s += "\n" if pkgs_kept_back: s += _("Packages with upgradable origin but kept back:\n") - s += " " + wrap(" ".join([pkg.name for pkg in pkgs_kept_back]), 70, " ") + s += " " + wrap(" ".join(pkgs_kept_back), 70, " ") s += "\n" s += "\n" s += _("Package installation log:")