Hi Paul,

Paul Gevers <elb...@debian.org> ezt írta (időpont: 2019. máj. 20., H, 20:38):
>
> Hi Jan, Bálint,
>
> On 20-05-2019 09:02, Jan Wagner wrote:
> > Am 12.05.19 um 12:41 schrieb Jan Wagner:
> >>>    * Skip sending email when no package had to be installed, upgraded
> >> or removed
> >>>      (LP: #1821103) (Closes: #924554)
> >> I'm still considering this as a regression and thus RC.
> >
> > DO we need to change severity to RC to get that fixed in buster?!?
> >
> > Anyway, any statement from your side would be a beginning.
>
> Sorry. The amount of changes that you propose to review is intimidating.
> If you can prepare a targeted fix, that would be *much* appreciated by
> us and much more likely end in a successful review. The sentence "If
> omitting some of the fixes is desired please state which ones can go in
> and which ones can't" probably achieved the opposite of what was wanted.
> It's hard for us to make that call.

OK, I understand. I hoped Release Team could take a look at the
referenced bugs and list the ones they would see important enough to
include in Buster. IMO letting 1.12 in would come with the least
amount of risk and would fix many issues already fixed in Ubuntu, but
I see that there is other important work to be done for the release,
too.

Please find the the patch attached for cherry-picking only the fix for
#924554. If you prefer adding only this fix to Buster I will upload
this change to unstable then it can be let to testing.

Cheers,
Balint

> Paul
>
diff --git a/debian/changelog b/debian/changelog
index 683fc19c..3cdce722 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+unattended-upgrades (1.11+deb10u1) unstable; urgency=medium
+
+  * Skip sending email when no package had to be installed, upgraded or removed
+    (LP: #1821103) (Closes: #924554)
+
+ -- Balint Reczey <rbal...@ubuntu.com>  Tue, 21 May 2019 09:37:03 +0200
+
 unattended-upgrades (1.11) unstable; urgency=medium
 
   * Use defaults in unattended-upgrades.service when the APT configuration is
diff --git a/debian/tests/common-functions b/debian/tests/common-functions
index 63f01389..c483dcc4 100644
--- a/debian/tests/common-functions
+++ b/debian/tests/common-functions
@@ -132,5 +132,20 @@ run_u_u() {
     chroot_exec "$chroot_dir" apt-mark showmanual | diff "$chroot_dir/tmp/manual" -
     chroot_exec "$chroot_dir" perl -MMIME::QuotedPrint -pe '$_=MIME::QuotedPrint::decode($_);' /var/mail/mail
 
+    printf  "Checking that no email is sent when nothing had to be done..."
+    if ! chroot_exec "$chroot_dir" perl -MMIME::QuotedPrint -pe '$_=MIME::QuotedPrint::decode($_);' /var/mail/mail | grep -q "unattended and no pending auto-removals"; then
+        echo "OK"
+    else
+        echo "FAILED, see last email above"
+    fi
+
+    printf  "Checking that no packages can be upgraded or auto-removed..."
+    if tail -n 1 "$chroot_dir/var/log/unattended-upgrades/unattended-upgrades.log" | grep -q "No packages found that can be upgraded unattended and no pending auto-removals"; then
+        echo "OK."
+    else
+        echo "Failed:"
+        cat "$chroot_dir/var/log/unattended-upgrades/unattended-upgrades.log"
+    fi
+
     rm "$chroot_dir/etc/apt/apt.conf.d/51unattended-upgrades-dpkg-frontend-check"
 }
diff --git a/unattended-upgrade b/unattended-upgrade
index 65795a2d..3773a34b 100755
--- a/unattended-upgrade
+++ b/unattended-upgrade
@@ -1119,6 +1119,9 @@ def send_summary_mail(pkgs,                 # type: List[str]
     if (res and apt_pkg.config.find_b(
             "Unattended-Upgrade::MailOnlyOnError", False)):
         return
+    # if the run was successful but nothing had to be done skip sending email
+    if (res and not pkgs and not pkgs_kept_back and not pkgs_removed):
+        return
     # Check if reboot-required flag is present
     reboot_flag_str = _(
         "[reboot required]") if os.path.isfile(REBOOT_REQUIRED_FILE) else ""

Reply via email to