package-data-downloader fails to process download requests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
update-notifier (Ubuntu) |
Fix Released
|
High
|
Brian Murray | ||
Xenial |
Fix Released
|
High
|
Brian Murray |
Bug Description
A persistent bug exists in the update notifier that affects the ttf-mscorefonts
---snip---
The following packages requested additional data downloads after package
installation, but the data could not be downloaded or could not be
processed.
ttf-mscorefon
The download will be attempted again later, or you can try the download
again now. Running this command requires an active Internet connection.
---endsnip---
Running the command fails. Manual installation of the ttf-mscorefonts
There are several issues in the package-
1. The function process_
Hook File: /usr/share/
Stamp File: /var/lib/
with the code:
---snip---
try:
if hook_date < stamp_date:
---endsnip---
The stamp file exist if there was a previous installation that did not produce a permanent failure. However, a normal failure sets up the condition to run this script. The failure condition is not cleared on success. The code related to determining success and failure is:
---snip---
---endsnip---
Therefore, in the event of a non-permanent failure, the stamp file is created or updated which prevents an followup download to correct the non-permanent failure.
2. The function process_
---snip---
for para in hook.iter_
* . . . . . if 'script' in para:
if not files:
* . . . . . . . command = [para['script']]
* . . . . . . . if 'should-download' in para:
* . . . . . . . . . . . should = db.get(
---endsnip---
---snip---
# Not in a 'script' stanza, so we should have some urls
try:
* . . . . . . . files.append(
* . . . . . . . sums.append(
except Exception as e:
---endsnip---
where * note the lines affected. These keywords begin with an uppercase in the related files:
---snip---
Url: http://
Sha256: 64595b5abc1080f
Script: /usr/lib/
Should-Download: msttcorefonts/
---endsnip---
3. The function process_
---snip---
previous_
# We only report about "permanent" failures when there are new ones,
# but we want the whole list of permanently-failing hooks so when
# we clobber the update-notifier file we don't lose information the
# user may not have seen yet
if permanent_failures:
for failure in permanent_failures:
if failure not in previous_failures:
if new_failures:
# Filter out new failure reports for permanently-failed packages
our_failures = [x for x in failures if x not in previous_failures]
if our_failures:
for failure in our_failures:
---endsnip---
SOLUTION:
=======
The existing code set up several conditions based on the existence of the following files:
stamp file
notifier file
notifier permanent file
The conditions are:
EXISTS ( stamp file )
EXISTS ( stamp file AND notifier file )
EXISTS ( notifier file AND notifier permanent file )
EXISTS ( notifier permanent file )
When no permanent failures are found (no notifier permanent file), the stamp file is set even when normal failures exist (notifier file). This causes the next script execution to skip to the next install item. In the event of success, failure conditions are cleared, but the notifier files are never cleared causing persistent requests to update that never get fulfilled.
For part 1, adding code handle the failure condition when a stamp file exists would be prudent:
---snip---
try:
> . . . . . if not os.path.
> . . . . . . . hook_date = os.stat(
> . . . . . . . stamp_date = os.stat(
> . . . . . . . if hook_date < stamp_date:
> . . . . . . . . . continue
> . . . . . elif os.path.
> . . . . . . . os.unlink(
---endsnip---
where > indicated the added/modded code. This corrects the problem by allowing any perceived failures, permanent or not, to reinstall the downloads. It always removes the stampfile so that if a permanent failure develops, it is handled correctly later.
For part 2, the paragraph keyword lookups may or may not care about case, but update the keywords:
'script', 'should-download', 'url', 'sha256'
to:
'Script', 'Should-Download', 'Url', 'Sha256'
so that they match the file.
For part 3, the comment suggests that the so called "update-notifier file" will be clobbered, but it never is. On a non-permament failure, the failed and permanent-failure marker files are removed when function create_
---snip---
previous_
# We only report about "permanent" failures when there are new ones,
# but we want the whole list of permanently-failing hooks so when
# we clobber the update-notifier file we don't lose information the
# user may not have seen yet
if permanent_failures:
for failure in permanent_failures:
if failure not in previous_failures:
if new_failures:
> . if not previous_failures and os.path.
> . . . os.unlink(
# Filter out new failure reports for permanently-failed packages
our_failures = [x for x in failures if x not in previous_failures]
if our_failures:
for failure in our_failures:
> . elif os.path.
> . . . os.unlink(
---endsnip---
where > indicated the added code.
In total, when no failure is found, the script will create the stamp file and clear the notifier files. For permanent failures, the stamp file is not created and any notifier files will persist until the next attempted update. For normal failures, the stamp and non-permanent notifier file persists until the next attempted update. On any update, if notifier files exist, the script will attempt to correct the install. If just the stamp file exists, then that install is skipped.
Related branches
- Dennis Kaarsemaker: Pending requested
- Diff: 0 lines
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
tags: | added: rls-y-incoming |
Changed in update-notifier (Ubuntu): | |
status: | New → In Progress |
Changed in update-notifier (Ubuntu Xenial): | |
assignee: | nobody → Brian Murray (brian-murray) |
importance: | Undecided → High |
status: | New → In Progress |
The attachment "Solution as per initial comment" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]