[Yum-devel] [PATCH] Check for bad checksum types at runtime. BZ 902357
James Antill
james at fedoraproject.org
Wed Jun 19 15:15:57 UTC 2013
On Wed, 2013-06-19 at 14:30 +0200, Zdenek Pavlas wrote:
> ---
> yum/misc.py | 10 ++++++----
> yum/yumRepo.py | 3 +++
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/yum/misc.py b/yum/misc.py
> index 8e21fe7..b4159c1 100644
> --- a/yum/misc.py
> +++ b/yum/misc.py
> @@ -252,11 +252,13 @@ class Checksums:
> if sumtype in done:
> continue
>
> + sumalgo = None
> if sumtype in _available_checksums:
> - sumalgo = hashlib.new(sumtype)
> - elif ignore_missing:
> - continue
> - else:
> + try: sumalgo = hashlib.new(sumtype)
> + except ValueError: pass
The idea was that .new() could never fail because _available_checksums
would always be correct ... at worst we should remove what is in
_available_checksums that isn't actually available, but createrepo looks
in that variable to see what is available (private variables ftw ;).
Probably better to do something like:
for algo in _available_checksums:
try:
hashlist.new(algo)
except: # remove it...
...on bootup. Ofc. I think md5 still calls abort in FIPS mode, so that's
probably not fun :).
More information about the Yum-devel
mailing list