Bug 466693

Summary: Discover checks for updates daily, regardless of the frequency set in the Software Sources dialog.
Product: [Applications] Discover Reporter: Alex <ab>
Component: NotifierAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: aleixpol, alsubbota, anael, anishjp, eliac8, franz.trischberger, nate, p.r.worrall, torricolas
Priority: NOR    
Version: 5.27.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Bug Depends on: 419055    
Bug Blocks:    

Description Alex 2023-03-02 06:15:04 UTC
+++ This bug was initially created as a clone of Bug #419055 +++

SUMMARY
Even when the user sets a lower frequency of automatic updates (e.g. weekly) in the Software Sources dialog, Discover nevertheless checks for updates daily. This means that effectively the user has no control over automatic update frequency.

STEPS TO REPRODUCE
1. In Discover, click on "Sources" -> "Software Sources". Provide the password if required.
2. In the "Software Sources" dialog that opens, click on "Updates". Make sure the "Check for updates" checkbox is checked, and choose a frequency other than "Daily" (e.g. "Weekly") in the corresponding dropdown. Click on "Close".

OBSERVED RESULT
Update notifications appear in the notifications area multiple times a week, presumably on every startup if updates are available.

EXPECTED RESULT
Update notifications appear at most once a week.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.2.1-arch1-1 (64-bit)
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8



ADDITIONAL INFORMATION
SUMMARY
Even when the user sets a lower frequency of automatic updates (e.g. weekly) in the Software Sources dialog, Discover nevertheless checks for updates daily. This means that effectively the user has no control over automatic update frequency.

STEPS TO REPRODUCE
1. In Discover, click on "Sources" -> "Software Sources". Provide the password if required.
2. In the "Software Sources" dialog that opens, click on "Updates". Make sure the "Check for updates" checkbox is checked, and choose a frequency other than "Daily" (e.g. "Weekly") in the corresponding dropdown. Click on "Close".

OBSERVED RESULT
Update notifications appear in the notifications area multiple times a week.

EXPECTED RESULT
Update notifications appear at most once a week.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 19.10
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION
This is a follow up to bug 401810 (Phabricator patch D17375) and bug 337752. Unfortunately, it appears that the issue wasn't resolved (at least not on my system).

My analysis shows that Discover's PackageKitNotifier attempts to check the frequency set in software-properties by running "apt-config dump" and looking for the "Apt::Periodic::Update-Package-Lists" property in its output. However, on my system the property name starts with uppercase "APT" rather than "Apt", and ends with a semicolon. Therefore PackageKitNotifier fails to find the correct property value, and falls back to the default of a daily check.
Comment 1 Paul Worrall 2023-03-02 13:37:15 UTC
Confirmed.  The setting seems to have been moved to System Settings -> Software Update

OBSERVED RESULT
For me it's set to "Weekly".  
The notifier told me updates were available so I installed them and rebooted, then the notifier came up again within a few hours

EXPECTED RESULT
After installing some updates, the notifier doesn't come up again until the selected period has expired (maybe an exception should be made for security updates)
Comment 2 Paul Worrall 2023-03-02 14:08:01 UTC
P.S. I'm on KDE Neon User edition, v5.27, with no Snaps or Flatpaks installed
Comment 3 Aleix Pol 2023-03-31 00:12:06 UTC
What output do you get for "apt-config dump"? Asking specifically for "Apt::Periodic::Update-Package-Lists"
Comment 4 Paul Worrall 2023-03-31 09:19:38 UTC
paul@neon-user:~$ apt-config dump|grep -i Periodic
paul@neon-user:~$ 

i.e. that config item isn't set
Comment 5 Aleix Pol 2023-03-31 15:53:25 UTC
That's the setting that Software Sources sets and where Discover looks for it. We cannot follow a setting that doesn't exist. :(
Comment 6 Paul Worrall 2023-03-31 22:58:56 UTC
I'm using the  "kcm_updates" KCM to change the value of "Notification Frequency"; that setting isn't in the Software Sources section of Discover.

The value I set is remembered between invocations, but it does not ask for a password or set "Apt::Periodic::Update-Package-Lists" and it does not seem to affect the frequency of update notifications.
Comment 7 Alexey 2023-08-03 15:38:47 UTC
Can I add here that I have the same bug in Fedora which uses dnf as a package manager instead of apt? Or should I create a new bug?
Comment 8 Nate Graham 2023-08-03 15:59:54 UTC
I think that's probably the same bug.
Comment 9 Anish 2023-10-05 09:47:25 UTC
Same issue in Fedora - KDE.

Cant even find the option "Check for updates" to uncheck in mine.

Discover 5.27.8
KDE Framework 5.109.0
Qt 5.15.10
Comment 10 Franz Trischberger 2024-04-06 17:53:35 UTC
Same issue here on opensuse tumbleweed with plasma 6.0.3.
I've set it to weekly but discover comes up daily.
Previously I had discover deinstalled+blacklisted, update to plasma6 ignored that blacklistingand installed it again.
I always manually updated the system, but wanted to give discover a chance.
Comment 11 Franz Trischberger 2024-04-07 13:23:58 UTC
https://invent.kde.org/plasma/discover/-/blob/master/notifier/DiscoverNotifier.cpp#L128
if (earliestNextNotificationTime.isValid() && earliestNextNotificationTime > QDateTime::currentDateTimeUtc()) {
        return false;
    }

Just an idea. In case earliestNextNotificationTime is NOT valid an updat notification is triggered.
Played with python:

>>> from PyQt6.QtCore import QDateTime
>>> c = QDateTime.fromString("2024,4,7,12,36,49.994")
>>> c.isValid()
False

I could not figure out in a reasonable amount of time how this whole kconf thing works and how it reads/writes DateTime objects, so this might turn out to be wrong.