Bug 1690894 - dnf download does not re-download damaged .rpm
Summary: dnf download does not re-download damaged .rpm
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.1
Assignee: Jaroslav Mracek
QA Contact: Luca Berton
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-20 12:23 UTC by Eva Mrakova
Modified: 2020-04-28 16:47 UTC (History)
7 users (show)

Fixed In Version: librepo-1.10.6-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:47:40 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1823 None None None 2020-04-28 16:47:54 UTC

Description Eva Mrakova 2019-03-20 12:23:56 UTC
Description of problem:
when an already downloaded .rpm is damaged, 'dnf download' does not re-download
the file and ends up with a strange error message.

Version-Release number of selected component (if applicable):
dnf-4.0.9.2-5.el8.noarch

How reproducible:
always for certain ways of damage

Steps to Reproduce:
1. dnf download bash
   (downloads bash-4.4.19-7.el8.x86_64.rpm)
2. echo whatever > bash-4.4.19-7.el8.x86_64.rpm
3. dnf download bash

Actual results:
# dnf download bash
[MIRROR] bash-4.4.19-7.el8.x86_64.rpm: Downloading successful, but checksum doesn't match. Calculated: 9cbe93e459acf1d1c437eebbe13bc2bb5b047ec44e8d454d5b827c353c1079ac(sha256)  Expected: 5976a32244ccd1e5cabf8fef04f7c65eae6802504344a14f08b9539f941189df(sha256) 
[FAILED] bash-4.4.19-7.el8.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success

Expected results:
.rpm is successfully re-downloaded


Additional info:
* when the damaged .rpm is removed, dnf download gets the file again without 
  any problems
* the bug is not present for certain ways of damages, e.g. when the damaged 
  file is empty or it is a part of the non-damaged original .rpm, etc.

Comment 2 Jaroslav Mracek 2019-03-29 11:38:52 UTC
I am sorry, but I am unable to reproduce the issue using reproducer above.
dnf-4.2.3-1.git.8777.b570a46.fc29.noarch
dnf-plugins-core-4.0.6-1.fc29.noarch


Please could you provide some additional data?

Comment 3 Eva Mrakova 2019-03-29 12:01:10 UTC
I'm still able to reproduce the bug on rhel8 with the packages
dnf-plugins-core-4.0.2.2-3.el8.noarch
dnf-4.0.9.2-5.el8.noarch
exactly the same way as described in comment 0. Also for other packages than bash.

This is a console log for 'dnf -v download...' (other repos disabled just to shorten the log):

# cat bash-4.4.19-7.el8.x86_64.rpm
whatever
# dnf --disablerepo=* --enablerepo=rhel -v download bash
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
DNF version: 4.0.9
cachedir: /var/cache/dnf
Repository beaker-client-testing is listed more than once in the configuration
rhel                                            2.3 kB/s | 2.3 kB     00:01    
reviving: 'rhel' can be revived - repomd matches.
not found other for: rhel
not found modules for: rhel
not found deltainfo for: rhel
not found updateinfo for: rhel
rhel: using metadata from Wed 27 Mar 2019 12:02:58 AM EDT.
No module defaults found
Completion plugin: Generating completion cache...
[MIRROR] bash-4.4.19-7.el8.x86_64.rpm: Downloading successful, but checksum doesn't match. Calculated: 9cbe93e459acf1d1c437eebbe13bc2bb5b047ec44e8d454d5b827c353c1079ac(sha256)  Expected: 5976a32244ccd1e5cabf8fef04f7c65eae6802504344a14f08b9539f941189df(sha256) 
[FAILED] bash-4.4.19-7.el8.x86_64.rpm: No more mirrors to try - All mirrors were already tried without success
# rm -f bash-4.4.19-7.el8.x86_64.rpm
# dnf --disablerepo=* --enablerepo=rhel -v download bash
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
DNF version: 4.0.9
cachedir: /var/cache/dnf
Repository beaker-client-testing is listed more than once in the configuration
rhel                                            2.3 kB/s | 2.3 kB     00:01    
reviving: 'rhel' can be revived - repomd matches.
not found other for: rhel
not found modules for: rhel
not found deltainfo for: rhel
not found updateinfo for: rhel
rhel: using metadata from Wed 27 Mar 2019 12:02:58 AM EDT.
No module defaults found
Completion plugin: Generating completion cache...
bash-4.4.19-7.el8.x86_64.rpm                     60 MB/s | 1.5 MB     00:00    


What other kind of additional data would help?

Comment 5 Jaroslav Mracek 2019-07-29 07:28:27 UTC
I create a patch (https://github.com/rpm-software-management/librepo/pull/162). The problem was that downloaded package keeps 'user.Librepo.DownloadInProgress=0sAA==' file attribute therefore librepo thinks that the last download was interrupted. The patch remove the attribute after successful download.

Also it requires patches from related pull requests - https://github.com/rpm-software-management/librepo/pull/158, https://github.com/rpm-software-management/librepo/pull/161, to fully resolve the issue. They allows to try multiple times to download content over damaged rpm.

Comment 6 Jaroslav Mracek 2019-07-29 08:28:36 UTC
I have also a problem to create a test for the issue because it requires a file system that allows usage of extended file attributes. The attributes can be seen by getfattr -d -m - file bash-5.0.7-1.fc30.x86_64.rpm.

The original librepo keeps user.Librepo.DownloadInProgress=0sAA==.

The patch change key to user.Librepo.DownloadInProgress="1" and removes the key after successful download.

Please do you have any idea how to test it?

Comment 14 errata-xmlrpc 2020-04-28 16:47:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1823


Note You need to log in before you can comment on or make changes to this bug.