Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 411897

Summary: Fail correctly in perform_checksum
Product: Portage Development Reporter: Greg Turner <gmturner007>
Component: Core - External InteractionAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: minor CC: gmturner007
Priority: Low Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 409383    
Attachments: Fail correctly when not finding the requested hash function in perform_checksum
Don't fail in the first place, and don't fail to not fail :)

Description Greg Turner 2012-04-13 23:28:50 UTC
Python 2.7 barfs on this code:

raise FooException( hashname + " bar baz" )

See attached patch

Reproducible: Always

Steps to Reproduce:
emerge -C dev-python/pycrypto
python2.7 -c "from portage.checksum import perform_all; perform_all('/dev/null')"
Actual Results:  
TypeError: unsupported operand type(s) for +: 'function' and 'str'

Expected Results:  
portage.exception.DigestException: <function getsize at 0xffeaaed4> hash function not available (needs dev-python/pycrypto)

Tested on slightly out-of-date prefix tree so... conceivably this is an out-of-date bug; even so --  the enclosed str()-based implementation is slightly more robust as evidenced by the above.
Comment 1 Greg Turner 2012-04-13 23:34:24 UTC
Created attachment 308835 [details, diff]
Fail correctly when not finding the requested hash function in perform_checksum
Comment 2 Greg Turner 2012-04-13 23:38:09 UTC
Obviously, begs the question of why function getsize is there in the first place... :)

But there I start to feel like maybe my tree is at fault somehow so I'll leave that to those of you plugged into git.
Comment 3 Greg Turner 2012-04-14 00:04:21 UTC
Created attachment 308839 [details, diff]
Don't fail in the first place, and don't fail to not fail :)

Fixes a bug in my previous patch and fixes the underlying problem for extra credit :)
Comment 4 Greg Turner 2012-04-14 00:14:49 UTC
^^ note: code works, but still failed to make convoluted witty comment correctly :)

sorry, couldn't resist... Ill shut up now.
Comment 6 Zac Medico gentoo-dev 2012-04-23 00:00:04 UTC
This is fixed in 2.1.10.57 and 2.2.0_alpha101.