Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1774103

Summary: The '--delete' option when used with reposync command deletes the packages immediately after download.
Product: Red Hat Enterprise Linux 8 Reporter: Abhijeet Joshi <abjoshi>
Component: dnf-plugins-coreAssignee: Marek Blaha <mblaha>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: amatej, james.antill, jcastran, mblaha, rainer.traut
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-plugins-core-4.0.12-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:49:06 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 Abhijeet Joshi 2019-11-19 15:17:45 UTC
Description of problem:
* The '--delete' option if used with reposync command immediately deletes the packages after download which it should not.


Scenario 1: If only 1 repo is used:

The packages are getting downloaded properly and not deleted.
---------------------------------------------------------------------
[root@rhel8 pub]# dnf reposync -p /var/ftp/pub/ --delete --download-metadata -n -m --repo=ansible-2-for-rhel-8-x86_64-rpms
Updating Subscription Management repositories.
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPM  12 kB/s | 4.0 kB     00:00    
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPM 147 kB/s | 1.0 MB     00:06    
comps.xml for repository ansible-2-for-rhel-8-x86_64-rpms saved
(1/3): ansible-test-2.9.0-2.el8.noarch.rpm      889 kB/s | 430 kB     00:00    
(2/3): ansible-2.9.0-2.el8.noarch.rpm            12 MB/s |  17 MB     00:01    
(3/3): sshpass-1.06-3.el8ae.x86_64.rpm          7.1 kB/s |  27 kB     00:03 
---------------------------------------------------------------------


Scenario 2: When multiple repos are used:

The packages are immediately being deleted after download.
---------------------------------------------------------------------
[root@rhel8 pub]# dnf reposync -p /var/ftp/pub/ --delete --download-metadata -n -m --repo=ansible-2-for-rhel-8-x86_64-rpms --repo=ansible-2.8-for-rhel-8-x86_64-rpms
Updating Subscription Management repositories.
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPM  11 kB/s | 4.0 kB     00:00    
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (R  13 kB/s | 4.0 kB     00:00    
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPM 758 kB/s | 1.0 MB     00:01    
comps.xml for repository ansible-2-for-rhel-8-x86_64-rpms saved
(1/3): sshpass-1.06-3.el8ae.x86_64.rpm           81 kB/s |  27 kB     00:00    
(2/3): ansible-test-2.9.0-2.el8.noarch.rpm      1.0 MB/s | 430 kB     00:00    
(3/3): ansible-2.9.0-2.el8.noarch.rpm            13 MB/s |  17 MB     00:01    
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (R 104 kB/s | 841 kB     00:08    
comps.xml for repository ansible-2.8-for-rhel-8-x86_64-rpms saved
(1/2): ansible-2.8.6-1.el8ae.noarch.rpm         6.9 MB/s |  15 MB     00:02    
(2/2): sshpass-1.06-3.el8ae.x86_64.rpm          3.3 kB/s |  27 kB     00:08    
[DELETED] /var/ftp/pub/ansible-2-for-rhel-8-x86_64-rpms/Packages/s/sshpass-1.06-3.el8ae.x86_64.rpm
[DELETED] /var/ftp/pub/ansible-2-for-rhel-8-x86_64-rpms/Packages/a/ansible-test-2.9.0-2.el8.noarch.rpm
[DELETED] /var/ftp/pub/ansible-2-for-rhel-8-x86_64-rpms/Packages/a/ansible-2.9.0-2.el8.noarch.rpm
---------------------------------------------------------------------


Scenario 3: When the '--delete' option is not used, the packages don't get deleted. 

--------------------------------------------------------------------------
[root@rhel8 pub]# dnf reposync -p /var/ftp/pub/ --download-metadata -n -m --repo=ansible-2-for-rhel-8-x86_64-rpms --repo=ansible-2.8-for-rhel-8-x86_64-rpms
Updating Subscription Management repositories.
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPM 6.8 kB/s | 4.0 kB     00:00    
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (R  12 kB/s | 4.0 kB     00:00    
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020190322125518:073fa5fe-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020190322130042:16b3ab4d-0.x86_64
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (RPM 714 kB/s | 1.0 MB     00:01    
comps.xml for repository ansible-2-for-rhel-8-x86_64-rpms saved
(1/3): ansible-test-2.9.0-2.el8.noarch.rpm      985 kB/s | 430 kB     00:00    
(2/3): ansible-2.9.0-2.el8.noarch.rpm            18 MB/s |  17 MB     00:00    
(3/3): sshpass-1.06-3.el8ae.x86_64.rpm          7.7 kB/s |  27 kB     00:03    
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (R 617 kB/s | 841 kB     00:01    
comps.xml for repository ansible-2.8-for-rhel-8-x86_64-rpms saved
(1/2): sshpass-1.06-3.el8ae.x86_64.rpm           80 kB/s |  27 kB     00:00    
(2/2): ansible-2.8.6-1.el8ae.noarch.rpm          16 MB/s |  15 MB     00:00    
--------------------------------------------------------------------------


Version-Release number of selected component (if applicable):
* Red Hat Enteprise Linux 8.


How reproducible:
* When multiple repos are synched at a time.

Steps to Reproduce:
1. dnf reposync -p /var/ftp/pub/ --delete --download-metadata -n -m --repo=ansible-2-for-rhel-8-x86_64-rpms
2. dnf reposync -p /var/ftp/pub/ --delete --download-metadata -n -m --repo=ansible-2-for-rhel-8-x86_64-rpms --repo=ansible-2.8-for-rhel-8-x86_64-rpms
3. dnf reposync -p /var/ftp/pub/ --download-metadata -n -m --repo=ansible-2-for-rhel-8-x86_64-rpms --repo=ansible-2.8-for-rhel-8-x86_64-rpms

Actual results:
* The packages are getting deleted immeidiately after download.

Expected results:
* The packages should be retained. 

Additional info:
* Here if only 1 repos is synced the issue doesn't occur. It looks like it only checks the last repository and deletes every other repo.

Comment 1 Marek Blaha 2019-11-28 06:51:26 UTC
PR https://github.com/rpm-software-management/dnf-plugins-core/pull/374 fixes the issue.

Comment 8 errata-xmlrpc 2020-04-28 16:49:06 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