Re: createrepo cache and checksum type

Axel Thimm <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
On Fri, Apr 17, 2009 at 02:24:18PM -0400, James Antill wrote:
> On Fri, 2009-04-17 at 19:12 +0300, Axel Thimm wrote:
> > it looks like the current cache implementation doesn't distinguish
> > between different checksum types, so when switching back and forth
> > between sha and sha256 checksum types createrepo may pick up the wrong
> > checksum.
> [...]
> > The "key" is computed with the default checksum type which may not be
> > the same as self.checksum_type
> 
>  I think this is the real bug, and fixing it will solve your problem?

It's a different bug, but fixing it will also fix the other bug. OTOH
what is easier to grok:

foo-1.2.3-4.x86_64.rpm-<sha256 checksum of key>-8587526-1170449203-sha256
foo-1.2.3-4.x86_64.rpm-<sha checksum of key>-8587526-1170449203-sha

or

foo-1.2.3-4.x86_64.rpm-<sha256 checksum of key>-8587526-1170449203
foo-1.2.3-4.x86_64.rpm-<sha checksum of key>-8587526-1170449203

The ambiguity is fixed, but for humans it's easier to debug the upper
set.

> I've committed:
> 
> commit 6ab7964d633cadbecb387b98353342b19f178a28
> Author: James Antill <[email protected]>
> Date:   Fri Apr 17 14:22:49 2009 -0400
> 
>     Use the same checksum type for the key, as for the data in the key
> 
> diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
> index b820fd8..32eed04 100644
> --- a/createrepo/yumbased.py
> +++ b/createrepo/yumbased.py
> @@ -60,7 +60,7 @@ class CreateRepoPackage(YumLocalPackage):
>          if type(self.hdr[rpm.RPMTAG_HDRID]) is not types.NoneType:
>              t.append("".join(self.hdr[rpm.RPMTAG_HDRID]))
>  
> -        kcsum = misc.Checksums()
> +        kcsum = misc.Checksums(checksums=[self.checksum_type])
>          kcsum.update("".join(t))
>          key = kcsum.hexdigest()
>                                                  
> 

-- 
Axel.Thimm at ATrpms.net

_______________________________________________
Rpm-metadata mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/rpm-metadata
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkno0gcACgkQQBVS1GOamfGFrQCgiP/viYYQBS1qL8BtmLwYBmN/
beUAoIBdASQgMRkrswSkb+xNCjVmaWXh
=brMg
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.