All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: kvm@vger.kernel.org
Cc: Lucas Meneghel Rodrigues <lmr@redhat.com>
Subject: [PATCH 4/5] Sanitizing strings before passing them to the logging system.
Date: Fri, 22 May 2009 16:16:46 -0300	[thread overview]
Message-ID: <1243019807-21078-4-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1243019807-21078-3-git-send-email-lmr@redhat.com>

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)
 
 
-- 
1.6.2.2


      parent reply	other threads:[~2009-05-22 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 19:16 [PATCH 1/5] Moving from kvm_log to the upstream logging system Lucas Meneghel Rodrigues
2009-05-22 19:16 ` [PATCH 2/5] Fixing exception raising to be compliant with the autotest coding standard Lucas Meneghel Rodrigues
     [not found]   ` <1243019807-21078-3-git-send-email-lmr@redhat.com>
2009-05-22 19:16     ` Lucas Meneghel Rodrigues [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1243019807-21078-4-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.