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

Bug 530982

Summary: sys-apps/portage-2.2.14: old_tree_timestamp_warn raises UnicodeDecodeError
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: nesuno
Priority: Normal Keywords: InVCS
Version: 2.2   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 484436    

Description Zac Medico gentoo-dev 2014-11-28 12:06:14 UTC
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emerge", line 50, in <module>
    retval = emerge_main()
  File "/usr/lib64/python2.7/site-packages/_emerge/main.py", line 1070, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 4082, in run_action
    emerge_config.args, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 99, in action_build
    old_tree_timestamp_warn(settings['PORTDIR'], settings)
  File "/usr/lib64/python2.7/site-packages/_emerge/sync/old_tree_timestamp.py", line 98, in old_tree_timestamp_warn
    time.strftime('%c', time.localtime(lastsync)))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128)

This fixes it:

--- a/pym/_emerge/sync/old_tree_timestamp.py
+++ b/pym/_emerge/sync/old_tree_timestamp.py
@@ -7,7 +7,7 @@ import locale
 import logging
 import time
 
-from portage import os
+from portage import os, _unicode_decode
 from portage.exception import PortageException
 from portage.localization import _
 from portage.output import EOutput
@@ -95,6 +95,7 @@ def old_tree_timestamp_warn(portdir, settings):
 				whenago(unixtime - lastsync))
 		else:
 			out.ewarn(_("Last emerge --sync was %s.") % \
-				time.strftime('%c', time.localtime(lastsync)))
+				_unicode_decode(time.strftime(
+				'%c', time.localtime(lastsync))))
 		return True
 	return False
Comment 1 Zac Medico gentoo-dev 2014-11-28 12:42:33 UTC
The patch is in this branch:

	https://github.com/zmedico/portage/tree/bug_530982

I've posted it for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4844
Comment 2 Zac Medico gentoo-dev 2014-11-28 20:24:58 UTC
This is in the master branch now:

https://github.com/gentoo/portage/commit/8bbc73b48e6fe14e5658f97b9abce23f52afb049
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2014-12-04 05:34:49 UTC
This is in the portage-2.2.15 release.
Comment 4 Zac Medico gentoo-dev 2015-04-17 17:17:20 UTC
*** Bug 546922 has been marked as a duplicate of this bug. ***