From patchwork Fri May 22 19:16:46 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 25449 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4MJH4fT006473 for ; Fri, 22 May 2009 19:17:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756905AbZEVTQ6 (ORCPT ); Fri, 22 May 2009 15:16:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756755AbZEVTQ6 (ORCPT ); Fri, 22 May 2009 15:16:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53854 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756619AbZEVTQ5 (ORCPT ); Fri, 22 May 2009 15:16:57 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4MJGxVd015142 for ; Fri, 22 May 2009 15:16:59 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4MJGwRd008075; Fri, 22 May 2009 15:16:58 -0400 Received: from localhost.localdomain (vpn-13-120.rdu.redhat.com [10.11.13.120]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4MJGmIL031495; Fri, 22 May 2009 15:16:57 -0400 From: Lucas Meneghel Rodrigues To: kvm@vger.kernel.org Cc: Lucas Meneghel Rodrigues Subject: [PATCH 4/5] Sanitizing strings before passing them to the logging system. Date: Fri, 22 May 2009 16:16:46 -0300 Message-Id: <1243019807-21078-4-git-send-email-lmr@redhat.com> In-Reply-To: <1243019807-21078-3-git-send-email-lmr@redhat.com> References: <1243019807-21078-1-git-send-email-lmr@redhat.com> <1243019807-21078-2-git-send-email-lmr@redhat.com> <1243019807-21078-3-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The logging system encodes messages using the utf-8 encoding by default. So sometimes it's necessary to re-encode lines when non unicode characters are thrown up by the command outputs. This patch re-encodes lines of text that will be passed to the logging system on the track_process function on kvm_utils. --- client/tests/kvm_runtest_2/kvm_utils.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm_runtest_2/kvm_utils.py b/client/tests/kvm_runtest_2/kvm_utils.py index bcc80a1..9ef5954 100644 --- a/client/tests/kvm_runtest_2/kvm_utils.py +++ b/client/tests/kvm_runtest_2/kvm_utils.py @@ -755,6 +755,9 @@ def track_process(sub, status_output=None, term_func=None, stdout_func=None, # Call stdout_func with the returned text if stdout_func: text = prefix + text.strip() + # We need to sanitize the text before passing it to the logging + # system + text = text.decode('utf-8', 'replace') stdout_func(text)