#4202 RawHeader: fix store offsets when duplicate tags are present
Merged by tkopecek. Opened by mikem.
mikem/koji rawheader-duptags  into  master

Download 4202.patch

For context, see https://pagure.io/koji/issue/4200

If an rpm has duplicate tags in a header, Koji would miscalculate the
start of that data store.

Fixes https://pagure.io/koji/issue/4203

1 new commit added

  • fix misleading comment

:thumbsup:

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

testing notes

  • an example rpm that triggers this (rh internal) is linked in #4200
  • the only place we actually use RawHeader in koji is when importing rpm signatures. The rpm referenced above is signed, so simply importing it into a test instance is a basic test of this
  • that said, it's hard to distinguish if the fallback code from the old workaround is happening

Testing the code directly is fairly straightforward. E.g. if I use the problem rpm, I get:

>>> import koji
>>> fn='/home/mikem/wu-ftpd-2.6.1-20.src.rpm'
>>> sighdr = koji.rip_rpm_sighdr(fn)
>>> rawhdr = koji.RawHeader(sighdr)
>>> koji.hex_string(rawhdr.get(koji.RPM_SIGTAG_MD5))
'f75f2047ffe5b35eb3ecb6ebd80baf41'

Which matches rpm

$ rpm -qp --qf '%{sigmd5}\n' wu-ftpd-2.6.1-20.src.rpm 
f75f2047ffe5b35eb3ecb6ebd80baf41

Running the same code without this fix gives an incorrect sigmd5

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

Commit 177ba351 fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata