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

Bug 587198

Summary: sys-apps/portage: chpathtool.py does not work with python3
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: prefix
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 604854    

Description Zac Medico gentoo-dev 2016-06-26 23:18:29 UTC
Currently, chpathtool.py does not work with python3 because it tries to compare a byte string with and integer, which always returns files. The following change fixes the problem, and works with both python2 and python3:

diff --git a/bin/chpathtool.py b/bin/chpathtool.py
index 73c7a5f..fbd18b9 100755
--- a/bin/chpathtool.py
+++ b/bin/chpathtool.py
@@ -89,7 +89,7 @@ def chpath_inplace(filename, is_text_file, old, new):
 		if not in_byte:
 			break
 
-		if in_byte == old[matched_byte_count]:
+		if in_byte == old[matched_byte_count:matched_byte_count+1]:
 			matched_byte_count += 1
 			if matched_byte_count == len_old:
 				modified = True
Comment 1 Zac Medico gentoo-dev 2016-06-26 23:42:07 UTC
This is fixed in the master branch:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=8781a2a86b05cf2bc522fca9a22883844a64fdf6
Comment 2 Zac Medico gentoo-dev 2017-02-10 18:48:56 UTC
Fixed in portage-2.3.3.