commit:     8bbc73b48e6fe14e5658f97b9abce23f52afb049
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 28 12:17:27 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov 28 20:16:00 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8bbc73b4

old_tree_timestamp: fix UnicodeDecodeError (530982)

Use _unicode_decode to safely decode bytes returned from time.strftime
for python-2.x (_unicode_decode allows unicode to pass through for
python-3.x).

X-Gentoo-Bug: 530982
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=530982
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

---
 pym/_emerge/sync/old_tree_timestamp.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/sync/old_tree_timestamp.py 
b/pym/_emerge/sync/old_tree_timestamp.py
index aa23a27..aaed18b 100644
--- 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

Reply via email to