#796 Fix comparison with Enum value
Merged 6 years ago by mikem. Opened 6 years ago by puiterwijk.
puiterwijk/koji checksumcomp  into  master

file modified
+1 -1
@@ -5581,7 +5581,7 @@ 

                          (filesize, fileinfo['filename'], fileinfo['filesize']))

  

              # checksum

-             if koji.CHECKSUM_TYPES[fileinfo['checksum_type']] != 'md5':

+             if fileinfo['checksum_type'] != 'md5':

                  # XXX

                  # until we change the way we handle checksums, we have to limit this to md5

                  raise koji.GenericError("Unsupported checksum type: %(checksum_type)s" % fileinfo)

The CHECKSUM_TYPES[...] call returns the index in the Enum field, not a string,
which meant that the comparison would never work.

Reported-by: Clement Verna cverna@tutanota.com
Signed-off-by: Patrick Uiterwijk patrick@puiterwijk.org

Fixes #813

If the current code is wrong, then cg imports should never have worked, yet they have

Reported-by: Clement Verna cverna@tutanota.com

Does this mean there is a bug report somewhere? Can we get details on an actual case of bad behavior from Koji?

Hmm, seems to have broken between 1.14 and 1.15

$ lkoji import-cg mock-deb-1.1.33-1.test6.json .
Uploading ./mock_1.1.33-1_all.deb
[====================================] 100% 00:00:00 138.44 KiB  13.69 MiB/sec
GenericError: Unsupported checksum type: md5

Seems to have happened in PR#446. The check was adapted from one in import_archive_internal(), but the data is a little different here.

no need to convert both here. In this part, we're expected a string value, so we should be able to just compare that with 'md5'

@mikem I got this issue while testing OSBS built on rawhide, if needed I can reproduce and keep the logs.

rebased onto e45c909

6 years ago

I filed #813 so that this is on the roadmap

Commit d1db97b fixes this pull-request

Pull-Request has been merged by mikem

6 years ago

This fix exposes #811 which is in turn fixed by #812

Metadata