Bug 1399235

Summary: yum reposync fails to download rpms that already exist in the repo
Product: Red Hat Enterprise Linux 7 Reporter: Nadav Goldin <ngoldin>
Component: yum-utilsAssignee: Michal Domonkos <mdomonko>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: dcaroest, eedri, extras-qa, ngoldin, nicolas, packaging-team-maint, tim.lauridsen, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1332441 Environment:
Last Closed: 2017-01-11 17:08:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nadav Goldin 2016-11-28 15:31:52 UTC
+++ This bug was initially created as a clone of Bug #1332441 +++

Description of problem:
When running reposync for multiple during multiple days downloading rpms to the same dir (to keep a local copy up of the repos up to date) I'm seeing that from time to time it starts failing to download some rpm with the error:

python-ioprocess-0.15.0-4.el7. FAILED                                          
python-ioprocess-0.15.0-4.el7.noarch: [Errno 256] No more mirrors to try.


Version-Release number of selected component (if applicable):
# rpm -qa yum-utils
yum-utils-1.1.31-508.fc23.noarch


How reproducible:
You can use this yum config:

# cat test.repo 
[main]
reposdir=/etc/reposync.repos.d
retries=3
debuglevel=10
rpmverbosity=debug
[epel-el7]
name=EPEL repo
baseurl=https://dl.fedoraproject.org/pub/epel/7/x86_64/
enabled=1
gpgcheck=0


Then run reposync:

 "reposync" "--config=test.repo" "--download_path=/tmp/reposync" "--newest-only" "--delete" "--cachedir=/tmp/reposync_cache"  "--repoid=epel-el7"


If eventually (usually the day after) reposync will start failing, even though it has the rpm there:

# tree /tmp/reposync
/tmp/reposync
└── epel-el7
    ├── g
    ├── i
    ├── l
    ├── m
    ├── p
    │   └── python-ioprocess-0.15.0-4.el7.noarch.rpm
    └── s

If you remove the rpm manually, it redownloads it and continues successfully.

Steps to Reproduce:
1.
2.
3.

Actual results:
Reposync complains about being unable to download from any mirrors and fails

Expected results:
Reposync succeeds, either 

Additional info:


The old rpm:

 rpm -qpi /tmp/reposync/epel-el7/p/python-ioprocess-0.15.0-4.el7.noarch.rpm 
warning: /tmp/reposync/epel-el7/p/python-ioprocess-0.15.0-4.el7.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 61e8806c: NOKEY
Name        : python-ioprocess
Version     : 0.15.0
Release     : 4.el7
Architecture: noarch
Install Date: (not installed)
Group       : System Environment/Base
Size        : 55223
License     : GPLv2+
Signature   : RSA/SHA1, Thu 17 Dec 2015 04:48:02 PM CET, Key ID 7aebbe8261e8806c
Source RPM  : ioprocess-0.15.0-4.el7.src.rpm
Build Date  : Fri 11 Dec 2015 09:57:17 AM CET
Build Host  : c1bg.rdu2.centos.org
Relocations : (not relocatable)
Packager    : CBS <cbs>
Vendor      : CentOS
URL         : https://github.com/oVirt/ioprocess
Summary     : Python bindings for ioprocess
Description :
Python bindings for ioprocess


The rpm it's replaced by once you remove it:
[root@dev-20 ovirt-system-tests]# rm /tmp/reposync/epel-el7/p/python-ioprocess-0.15.0-4.el7.noarch.rpm
rm: remove regular file ‘/tmp/reposync/epel-el7/p/python-ioprocess-0.15.0-4.el7.noarch.rpm’? y
[root@dev-20 ovirt-system-tests]# "reposync" "--config=test.repo" "--download_path=/tmp/reposync" "--newest-only" "--delete" "--cachedir=/tmp/reposync_cache"  "--repoid=epel-el7" 

Yum-utils package has been deprecated, use dnf instead.
See 'man yum2dnf' for more information.


Config time: 0.007
repo time: 0.001
Setting up Package Sacks
pkgsack time: 0.364
rpmdb time: 0.0000.15.0-4.el7.noarch.rpm                                                                  0% [                                                                                               ]  0.0 B/s |    0 B  --:--:-- ETA 
python-ioprocess-0.15.0-4.el7.noarch.rpm                                                                                                                                                                                |  23 kB  00:00:01     
[root@dev-20 ovirt-system-tests]# rpm -qpi /tmp/reposync/epel-el7/p/python-ioprocess-0.15.0-4.el7.noarch.rpm 
warning: /tmp/reposync/epel-el7/p/python-ioprocess-0.15.0-4.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Name        : python-ioprocess
Version     : 0.15.0
Release     : 4.el7
Architecture: noarch
Install Date: (not installed)
Group       : System Environment/Base
Size        : 55223
License     : GPLv2+
Signature   : RSA/SHA256, Sun 29 Nov 2015 07:44:25 PM CET, Key ID 6a2faea2352c64e5
Source RPM  : ioprocess-0.15.0-4.el7.src.rpm
Build Date  : Sun 29 Nov 2015 03:37:09 PM CET
Build Host  : buildhw-09-nfs.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://github.com/ficoos/ioprocess
Summary     : Python bindings for ioprocess
Description :
Python bindings for ioprocess

--- Additional comment from Nadav Goldin on 2016-11-21 11:07:16 EST ---

Hi, any news on this?

--- Additional comment from Valentina Mukhamedzhanova on 2016-11-22 07:10:33 EST ---

(In reply to Nadav Goldin from comment #2)
> Hi, any news on this?

yum and yum-utils are discontinued on Fedora. Fedora users should be using dnf at this point. If you would like to propose this BZ for fixing on RHEL, please change the Product to RHEL. Otherwise, I would suggest closing this BZ.

--- Additional comment from Fedora End Of Life on 2016-11-25 03:55:13 EST ---

This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 1 Nadav Goldin 2016-11-28 16:06:20 UTC
I am able to reproduce this issue locally with createrepo/reposync:
Assume 'remote_repo' serves a RPM named 'dummy-something.rpm' with 'Release=1' field.
Run reposync, then recreate the RPM with the exact same spec file,
except 'Release=2' field, keeping the exact same filename and rebuild
the yum repository(with createrepo). Running reposync again will fail with:
[Errno 256] No more mirrors to try.

I know its not the best practice to keep the same RPM filename for different
releases, however MANY packages do so(like python-ioprocess). Moreover,
the error message indicates nothing of the true error.

I think the expected should be that the latest RPM(the one with 'Release=2' in
the example) should be downloaded, like yum would behave. 


Steps to reproduce locally:

1. create a dummy spec file
cat dummy.spec
>Name: dummy-rpm
Version: 1.0
Release:	1
Summary: dummy summary
License: Public domain

%description
test-reposync-failure
%install
%files
%changelog

2. build the RPM
3. run createrepo on the RPM's directory.

4. run reposync with the local repository
configured(here it is /home/ngoldin/tmp/reposync-bz/remote_repo/el7)

>cat reposync-config.repo
[main]
reposdir=/etc/reposync.repos.d
[test-reposync]
name=test reposync
baseurl=file:///home/ngoldin/tmp/reposync-bz/remote_repo/el7
enabled=1
gpgcheck=0

> reposync --config=reposync-config.repo --download_path=/home/ngoldin/tmp/reposync-bz/local_sync

5. re-generate the rpm with 'Release=2'(and keeping the same filename)
>rpm -qip dummy-rpm-1.0-1.el7.x86_64.rpm
Name        : dummy-rpm
Version     : 1.0
Release     : 2
...
Summary     : dummy summary
Description :
test-reposync-failure

5. Regenerate the local repo with createrepo.

6. Run reposync again and see the failure:

>reposync --config=reposync-config.repo --download_path=/home/ngoldin/tmp/reposync-bz/local_sync

dummy-rpm-1.0-1.el7.x86_64.rp FAILED
...
dummy-rpm-1.0-2.el7.x86_64: [Errno 256] No more mirrors to try.

Comment 3 Michal Domonkos 2017-01-11 17:04:12 UTC
(In reply to Nadav Goldin from comment #1)
> I am able to reproduce this issue locally with createrepo/reposync:
> Assume 'remote_repo' serves a RPM named 'dummy-something.rpm' with
> 'Release=1' field.
> Run reposync, then recreate the RPM with the exact same spec file,
> except 'Release=2' field, keeping the exact same filename and rebuild
> the yum repository(with createrepo). Running reposync again will fail with:
> [Errno 256] No more mirrors to try.

Actually, we seem to never have supported packages with the same filename but different NEVRA, at least not without issues.  So like you said, it's not advisable to use such packages in a yum repo (and, to my knowledge, there's no good reason to do so).  Anyway, if you think we should address this somehow, please consider filing a separate BZ.

Regarding python-ioprocess, I've checked the SRPM as well as the changelog and didn't find anything unusual, could you please elaborate a bit more on this (esp. in what repos did you encounter such packages?)

Comment 4 Michal Domonkos 2017-01-11 17:08:53 UTC
The bug itself (Comment 0) is caused by the reget feature of urlgrabber; yum (called from reposync) considers an existing package file a partial download and tries to resume the download (that's why deleting the file manually fixes that).

We already have such a report, so I'm going to close this as a dupe.

*** This bug has been marked as a duplicate of bug 1375514 ***

Comment 5 Eyal Edri 2017-09-11 11:14:33 UTC
clearing needinfo.