From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id AE650138CD0 for ; Mon, 18 May 2015 17:39:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 39F3AE0841; Mon, 18 May 2015 17:39:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 60ADFE0827 for ; Mon, 18 May 2015 17:39:08 +0000 (UTC) Received: from [10.128.12.146] (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 7A6FA3406F0 for ; Mon, 18 May 2015 17:39:06 +0000 (UTC) Message-ID: <555A23B8.8010709@gentoo.org> Date: Mon, 18 May 2015 10:39:04 -0700 From: Zac Medico User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] portage/sync/modules/rsync: Fix UnicodeDecodeError: bug 549826 References: <1431969625-27247-1-git-send-email-dolsen@gentoo.org> In-Reply-To: <1431969625-27247-1-git-send-email-dolsen@gentoo.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: e713875c-852b-42d8-90cd-ce273df1715b X-Archives-Hash: ab68c85212a097278a54406753b8868f On 05/18/2015 10:20 AM, Brian Dolbec wrote: > X-Gentoo-Bug: 549826 > X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=549826 > X-Gentoo-forums: https://forums.gentoo.org/viewtopic-t-1017380.html > --- > pym/portage/sync/modules/rsync/rsync.py | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py > index d3b0ae3..47ed1de 100644 > --- a/pym/portage/sync/modules/rsync/rsync.py > +++ b/pym/portage/sync/modules/rsync/rsync.py > @@ -12,6 +12,7 @@ import tempfile > > import portage > from portage import os > +from portage import _unicode_decode > from portage.util import writemsg_level > from portage.output import create_color_func, yellow, blue, bold > good = create_color_func("GOOD") > @@ -145,7 +146,8 @@ class RsyncSync(NewBase): > family, socket.SOCK_STREAM)) > except socket.error as e: > writemsg_level( > - "!!! getaddrinfo failed for '%s': %s\n" % (hostname, e), > + "!!! getaddrinfo failed for '%s': %s\n" > + % (_unicode_decode(hostname), str(e)), > noiselevel=-1, level=logging.ERROR) > > if addrinfos: > @@ -197,8 +199,8 @@ class RsyncSync(NewBase): > if uris: > dosyncuri = uris.pop() > else: > - writemsg("!!! Exhausted addresses for %s\n" % \ > - hostname, noiselevel=-1) > + writemsg("!!! Exhausted addresses for %s\n" > + % _unicode_decode(hostname), noiselevel=-1) > return (1, False) > > if (retries==0): > That str(e) call may be unsafe. We should use _unicode(e) like we do in bintree.py. -- Thanks, Zac