Merge lp:~rbalint/update-notifier/motd-stale-pkglist into lp:update-notifier/ubuntu

Proposed by Balint Reczey
Status: Merged
Merged at revision: 976
Proposed branch: lp:~rbalint/update-notifier/motd-stale-pkglist
Merge into: lp:update-notifier/ubuntu
Diff against target: 84 lines (+30/-1)
6 files modified
data/Makefile.am (+1/-1)
data/notify-updates-outdated (+19/-0)
debian/90-updates-available (+2/-0)
debian/changelog (+6/-0)
debian/update-notifier-common.install (+1/-0)
po/POTFILES.in (+1/-0)
To merge this branch: bzr merge lp:~rbalint/update-notifier/motd-stale-pkglist
Reviewer Review Type Date Requested Status
Julian Andres Klode Needs Fixing
Matthew Paul Thomas Pending
Review via email: mp+372675@code.launchpad.net

Description of the change

This is how MOTD looks like with the change:

-----
root@ee-debconf:~# update-motd
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.0.0-25-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Thu Sep 12 08:00:34 UTC 2019

  System load: 0.58 Processes: 30
  Usage of /home: unknown Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.84.73.74
  Swap usage: 81%

 * Congrats to the Kubernetes community on 1.16 beta 1! Now available
   in MicroK8s for evaluation and testing, with upgrades to RC and GA

     snap info microk8s

205 updates can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

root@ee-debconf:~# touch -t 01010101 /var/lib/update-notifier/updates-available
root@ee-debconf:~# update-motd
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.0.0-25-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Thu Sep 12 08:00:41 UTC 2019

  System load: 0.65 Processes: 30
  Usage of /home: unknown Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.84.73.74
  Swap usage: 81%

 * Congrats to the Kubernetes community on 1.16 beta 1! Now available
   in MicroK8s for evaluation and testing, with upgrades to RC and GA

     snap info microk8s

205 updates can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

The information about available updates is more than a week old.
To download information about new updates run: apt update

root@ee-debconf:~#
---

I chose to hardcode one week to keep the gettext string very simple and IMO it is a reasonable time after which staleness should be reported.

The message is also shown when the updates-available file does not exist:

---
root@ee-debconf:~# rm /var/lib/update-notifier/updates-available
root@ee-debconf:~# update-motd
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.0.0-25-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Thu Sep 12 08:07:42 UTC 2019

  System load: 0.77 Processes: 29
  Usage of /home: unknown Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.84.73.74
  Swap usage: 81%

 * Congrats to the Kubernetes community on 1.16 beta 1! Now available
   in MicroK8s for evaluation and testing, with upgrades to RC and GA

     snap info microk8s
The information about available updates is more than a week old.
To download information about new updates run: apt update
---

This is a bit ugly but it is not likely to occur in practice due shipping the file in official images.

I can add more code to handle that, too. For the first round I tried to keep the code very simple.

To post a comment you must log in.
Revision history for this message
Balint Reczey (rbalint) wrote :

I just added sudo to prefix apt command.

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

> I chose to hardcode one week to keep the gettext string very simple and
> IMO it is a reasonable time after which staleness should be reported.

Fair enough.

> snap info microk8s
> The information about available updates is more than a week old.

Has Launchpad muddled the display here, or is there really no blank line before the new text? It would be weird if there was often a blank line *within* the previous text (for example, within the Kubernetes stuff here), but not after it.

> The information about available updates is more than a week old.

This reads a bit mysterious. What kind of information? Their size? Their authors? Simpler just to say “It’s been more than a week since the last check for updates.”

Similarly, “To download information about new updates run:” could just be “To check now:”.

Revision history for this message
Balint Reczey (rbalint) wrote :

> > I chose to hardcode one week to keep the gettext string very simple and
> > IMO it is a reasonable time after which staleness should be reported.
>
> Fair enough.
>
> > snap info microk8s
> > The information about available updates is more than a week old.
>
> Has Launchpad muddled the display here, or is there really no blank line
> before the new text? It would be weird if there was often a blank line
> *within* the previous text (for example, within the Kubernetes stuff here),
> but not after it.

I added no newline before the text because there is an extra at the end in /var/lib/update-notifier/updates-available and I did not want to remove that now.
I see that it is ugly when /var/lib/update-notifier/updates-available is empty, thus I'm adding it now and maybe the extra line can be removed from updates-available later.

>
> > The information about available updates is more than a week old.
>
> This reads a bit mysterious. What kind of information? Their size? Their
> authors? Simpler just to say “It’s been more than a week since the last check
> for updates.”
>
> Similarly, “To download information about new updates run:” could just be “To
> check now:”.

Good points.
IMO "It’s been" is a bit informal though, how about:

The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Revision history for this message
Julian Andres Klode (juliank) wrote :

Looks OK, but we should not duplicate the gettext stuff.

Not sure why echo $(eval_gettext) rather than just eval_gettext

review: Needs Fixing
Revision history for this message
Balint Reczey (rbalint) wrote :

Now the output looks like this:

---
root@ee-motd:~# update-motd
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.0.0-27-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Thu Sep 19 15:12:29 UTC 2019

  System load: 3.13 Processes: 28
  Usage of /home: unknown Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.84.73.224
  Swap usage: 93%

0 updates can be installed immediately.
0 of these updates are security updates.

root@ee-motd:~# touch -t 01010101 /var/lib/update-notifier/updates-available
root@ee-motd:~# update-motd
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.0.0-27-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Thu Sep 19 15:12:55 UTC 2019

  System load: 2.89 Processes: 28
  Usage of /home: unknown Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.84.73.224
  Swap usage: 93%

0 updates can be installed immediately.
0 of these updates are security updates.

The list of available updates is more than a week old.
To check for new updates run: sudo apt update

root@ee-motd:~# rm /var/lib/update-notifier/updates-available
root@ee-motd:~# update-motd
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.0.0-27-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

  System information as of Thu Sep 19 15:13:16 UTC 2019

  System load: 2.35 Processes: 28
  Usage of /home: unknown Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.84.73.224
  Swap usage: 93%

The list of available updates is more than a week old.
To check for new updates run: sudo apt update

---

976. By Balint Reczey

Notify user about stale updates information in motd

LP: #1842159

977. By Balint Reczey

Update changelog

Revision history for this message
Matthew Paul Thomas (mpt) wrote :

> IMO "It’s been" is a bit informal though, how about:
>
> The list of available updates is more than a week old.

Ok, but it would invite the question: What list? Where?

I think “It’s been” is fine, but another way to avoid it would be: “The last check for updates was more than a week ago. To check now: sudo apt update”

Revision history for this message
Balint Reczey (rbalint) wrote :

> > IMO "It’s been" is a bit informal though, how about:
> >
> > The list of available updates is more than a week old.
>
> Ok, but it would invite the question: What list? Where?

I know it may be a bit mysterious for the first time user, but it is consistent with the command used to list updates which is also printed by "apt update"

root@ee2:~# apt update
Hit:1 http://archive.ubuntu.com/ubuntu eoan InRelease
Hit:2 http://security.ubuntu.com/ubuntu eoan-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu eoan-updates InRelease
Hit:4 http://archive.canonical.com/ubuntu eoan InRelease
Hit:5 http://archive.ubuntu.com/ubuntu eoan-proposed InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
343 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@ee2:~#

> I think “It’s been” is fine, but another way to avoid it would be: “The last
> check for updates was more than a week ago. To check now: sudo apt update”

The reason I would not use that is that the last check may have been attempted more recently but it may have failed. So I'd state the status, not the possible past events.
Also the check for updates may have never happened, it which case stating that it happened but more than a week ago would not be factually true causing possible confusion.

For the record this change got approved together with an other one in https://code.launchpad.net/~rbalint/update-notifier/updates-available-world-readable/+merge/373021 , so I would go with:

The list of available updates is more than a week old.
To check for new updates run: sudo apt update

I like that "To check now" is shorter, but may be a bit ambiguous also the longer for is consistent with the language used in ESM:

UA Infrastructure Extended Security Maintenance (ESM) is enabled.

35 updates can be installed immediately.
13 of these updates are provided through UA Infrastructure ESM.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/Makefile.am'
2--- data/Makefile.am 2017-09-29 14:37:12 +0000
3+++ data/Makefile.am 2019-09-19 21:17:19 +0000
4@@ -16,7 +16,7 @@
5 helper_SCRIPTS = apt_check.py apt-cdrom-check cddistupgrader update-motd-reboot-required update-motd-updates-available update-motd-fsck-at-reboot update-motd-hwe-eol backend_helper.py package-data-downloader package-system-locked
6
7 notifydir = $(datadir)/update-notifier
8-notify_SCRIPTS = notify-reboot-required
9+notify_SCRIPTS = notify-reboot-required notify-updates-outdated
10 notify_in_files = package-data-downloads-failed.in package-data-downloads-failed-permanently.in
11 notify_DATA = $(notify_in_files:.in=)
12
13
14=== added file 'data/notify-updates-outdated'
15--- data/notify-updates-outdated 1970-01-01 00:00:00 +0000
16+++ data/notify-updates-outdated 2019-09-19 21:17:19 +0000
17@@ -0,0 +1,19 @@
18+#!/bin/sh
19+
20+# we do not include ". gettext.sh" here because:
21+# a) it breaks if its not available
22+# b) the string we have here does not need it (because it has no vars)
23+eval_gettext() {
24+ if [ -x /usr/bin/gettext ]; then
25+ echo $(gettext "$1")
26+ else
27+ echo "$1"
28+ fi
29+}
30+export TEXTDOMAIN=update-notifier
31+export TEXTDOMAINDIR=/usr/share/locale
32+
33+# Print the message
34+echo ""
35+eval_gettext "The list of available updates is more than a week old."
36+eval_gettext "To check for new updates run: sudo apt update"
37
38=== modified file 'debian/90-updates-available'
39--- debian/90-updates-available 2015-11-13 11:18:56 +0000
40+++ debian/90-updates-available 2019-09-19 21:17:19 +0000
41@@ -3,3 +3,5 @@
42 stamp="/var/lib/update-notifier/updates-available"
43
44 [ ! -r "$stamp" ] || cat "$stamp"
45+
46+find $stamp -newermt 'now-7 days' 2> /dev/null | grep -q -m 1 '.' || /usr/share/update-notifier/notify-updates-outdated
47
48=== modified file 'debian/changelog'
49--- debian/changelog 2019-09-11 15:29:50 +0000
50+++ debian/changelog 2019-09-19 21:17:19 +0000
51@@ -1,3 +1,9 @@
52+update-notifier (3.192.27) UNRELEASED; urgency=medium
53+
54+ * Notify user about stale updates information in motd (LP: #1842159)
55+
56+ -- Balint Reczey <rbalint@ubuntu.com> Wed, 11 Sep 2019 18:38:27 +0200
57+
58 update-notifier (3.192.26) eoan; urgency=medium
59
60 * data/apt_check.py: modify wording and output regarding ESM support.
61
62=== modified file 'debian/update-notifier-common.install'
63--- debian/update-notifier-common.install 2016-08-05 22:00:54 +0000
64+++ debian/update-notifier-common.install 2019-09-19 21:17:19 +0000
65@@ -8,6 +8,7 @@
66 debian/98-fsck-at-reboot etc/update-motd.d
67 usr/share/polkit-1/actions/com.ubuntu.update-notifier.policy
68 usr/share/update-notifier/notify-reboot-required
69+usr/share/update-notifier/notify-updates-outdated
70 usr/share/update-notifier/package-data-downloads-failed
71 usr/share/update-notifier/package-data-downloads-failed-permanently
72 usr/lib/update-notifier/
73
74=== modified file 'po/POTFILES.in'
75--- po/POTFILES.in 2019-03-12 15:10:45 +0000
76+++ po/POTFILES.in 2019-09-19 21:17:19 +0000
77@@ -3,6 +3,7 @@
78 # *grumpf* [type=] does not work because intltool-update does not
79 # know about anything but the types available in intltool-extract --help
80 [type=gettext/Shell] data/notify-reboot-required
81+[type=gettext/Shell] data/notify-updates-outdated
82 data/apt_check.py
83 data/apt-cdrom-check
84 data/cddistupgrader

Subscribers

People subscribed via source and target branches

to all changes: