Bug 1025730

Summary: --skip-existing, Duplicates of an package can be uploaded if the sha256sum differ between the packages.
Product: [Retired] Pulp Reporter: pgustafs
Component: rpm-supportAssignee: pulp-bugs
Status: CLOSED NOTABUG QA Contact: pulp-qe-list
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.2CC: mhrivnak
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-08 15:23:58 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:

Description pgustafs 2013-11-01 11:58:05 UTC
Description of problem:
Duplicates of an  package can be uploaded if the md5sum differ between the packages.


Version-Release number of selected component (if applicable):
pulp-builtins-admin-extensions-2.2.0-1.el6.noarch
pulp-puppet-plugins-2.2.0-1.el6.noarch
pulp-rpm-consumer-extensions-2.2.0-1.el6.noarch
pulp-puppet-handlers-2.2.0-1.el6.noarch
pulp-consumer-client-2.2.0-1.el6.noarch
pulp-admin-client-2.2.0-1.el6.noarch
pulp-server-2.2.0-1.el6.noarch
pulp-rpm-plugins-2.2.0-1.el6.noarch
pulp-rpm-admin-extensions-2.2.0-1.el6.noarch
pulp-puppet-admin-extensions-2.2.0-1.el6.noarch
pulp-rpm-handlers-2.2.0-1.el6.noarch
pulp-selinux-2.2.0-1.el6.noarch
pulp-builtins-consumer-extensions-2.2.0-1.el6.noarch
pulp-agent-2.2.0-1.el6.noarch
pulp-puppet-consumer-extensions-2.2.0-1.el6.noarch



How reproducible:
Always


Steps to Reproduce:
1. upload an rpm to an repo:
pulp-admin rpm repo uploads rpm -f /tmp/foo-1.0-1.el6.x86_64.rpm --repo-id=test-repo2 --skip-existing
+----------------------------------------------------------------------+
                              Unit Upload
+----------------------------------------------------------------------+

Extracting necessary metadata for each request...
[==================================================] 100%
Analyzing: foo-1.0-1.el6.x86_64.rpm
... completed

Checking for existing RPMs on the server...
... completed

Creating upload requests on the server...
[==================================================] 100%
Initializing: foo-1.0-1.el6.x86_64.rpm
... completed

Starting upload of selected units. If this process is stopped through ctrl+c,
the uploads will be paused and may be resumed later using the resume command or
cancelled entirely using the cancel command.

Uploading: foo-1.0-1.el6.x86_64.rpm
[==================================================] 100%
1701/1701 bytes
... completed

Importing into the repository...
... completed

Deleting the upload request...
... completed

2. upload an rpm with same name,version and release as previous rpm, but different md5sum
pulp-admin rpm repo uploads rpm -f /tmp/foo-1.0-1.el6.x86_64.rpm --repo-id=test-repo2 --skip-existing
+----------------------------------------------------------------------+
                              Unit Upload
+----------------------------------------------------------------------+

Extracting necessary metadata for each request...
[==================================================] 100%
Analyzing: foo-1.0-1.el6.x86_64.rpm
... completed

Checking for existing RPMs on the server...
... completed

Creating upload requests on the server...
[==================================================] 100%
Initializing: foo-1.0-1.el6.x86_64.rpm
... completed

Starting upload of selected units. If this process is stopped through ctrl+c,
the uploads will be paused and may be resumed later using the resume command or
cancelled entirely using the cancel command.

Uploading: foo-1.0-1.el6.x86_64.rpm
[==================================================] 100%
1703/1703 bytes
... completed

Importing into the repository...
... completed

Deleting the upload request...
... completed

3. list the package
tree -s /var/lib/pulp/content/rpm/foo/1.0/1.el6/x86_64/
/var/lib/pulp/content/rpm/foo/1.0/1.el6/x86_64/
|-- [       4096]  b477450e8105173783cdd83578c38ec7c67bd8420ee93f716778dc09fc149fb1
|   `-- [       1703]  foo-1.0-1.el6.x86_64.rpm
`-- [       4096]  e56a18fc21f026b64d0c6185ca4523e5711853391020eb123e43dc7743645e29
    `-- [       1701]  foo-1.0-1.el6.x86_64.rpm




Actual results: 
An package with same name, version and release is uploaded twice to pulp.


Expected results:


Additional info:

Comment 1 pgustafs 2013-11-01 13:14:05 UTC
sed s/md5sum/sha256sum

Comment 2 Michael Hrivnak 2013-11-08 15:23:58 UTC
This is by design. Please see the explanation here: http://pulp-rpm-user-guide.readthedocs.org/en/pulp-2.2/faq.html#why-is-a-checksum-used-to-calculate-uniqueness-of-rpms

Comment 3 pgustafs 2013-11-11 14:44:04 UTC
(In reply to Michael Hrivnak from comment #2)
> This is by design. Please see the explanation here:
> http://pulp-rpm-user-guide.readthedocs.org/en/pulp-2.2/faq.html#why-is-a-
> checksum-used-to-calculate-uniqueness-of-rpms

Hi, Allowing two rpms with same NEVRA but different sha256sum in same repo causes yum to fail on the consumer.

Downloading Packages:
foo-1.0-1.noarch.rpm                                                                       | 1.9 kB     00:00     
https://mc-pulp-01.example.com/pulp/repos/pgustafs-test/foo-1.0-1.noarch.rpm: [Errno -1] Package does not match intended download. Suggestion: run yum --enablerepo=pgustafs-test clean metadata
Trying other mirror.

So i don't think two rpms with same NEVRA should be allowed in the same repo.

Br, Peter