This code doesn't work as intended in python3, because magic[16] is an integer: magic[16] in (b'\x02', b'\x03') So is_prelinkable_elf always returns False for python3: $ python3 -c "from portage.checksum import is_prelinkable_elf print(is_prelinkable_elf('/bin/bash'))" False $ python2.7 -c "from portage.checksum import is_prelinkable_elf print(is_prelinkable_elf('/bin/bash'))" True
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=5575570894c064976f701831d5a15bfa7f529935 commit 5575570894c064976f701831d5a15bfa7f529935 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2017-10-22 22:30:15 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2017-10-22 22:33:02 +0000 is_prelinkable_elf: fix for python3 (bug 635116) Change magic[16] to magic[16:17], since magic[16] returns an integer for python3. Bug: https://bugs.gentoo.org/635116 pym/portage/checksum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)}