All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Wood <michael.g.wood@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] report-error: Add a check for binary log file
Date: Thu, 29 Jan 2015 16:36:09 +0000	[thread overview]
Message-ID: <1422549369-23245-1-git-send-email-michael.g.wood@intel.com> (raw)

Check to see if the log file is a binary. If it is do not try to submit
it in our error-report.

[YOCTO #7263]

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
 meta/classes/report-error.bbclass | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 8b30422..101fe9b 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -24,6 +24,15 @@ def errorreport_savedata(e, newdata, file):
         json.dump(newdata, f, indent=4, sort_keys=True)
     return datafile
 
+def errorreport_testlogforbinary(data):
+    for c in data:
+      # If the data contains non visible character below 10 it's a binary
+      if (ord(c) < 10):
+        return True
+
+    return False
+
+
 python errorreport_handler () {
         import json
 
@@ -48,7 +57,13 @@ python errorreport_handler () {
             taskdata['task'] = task
             if log:
                 logFile = open(log, 'r')
-                taskdata['log'] = logFile.read()
+                # Detect binary log output
+                logdata = logFile.read()
+                if  errorreport_testlogforbinary(logdata):
+                    taskdata['log'] = "Log in binary format"
+                else:
+                    taskdata['log'] = logdata
+
                 logFile.close()
             else:
                 taskdata['log'] = "No Log"
-- 
2.1.0



             reply	other threads:[~2015-01-29 16:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 16:36 Michael Wood [this message]
2015-01-30 10:24 ` [PATCH] report-error: Add a check for binary log file Richard Purdie
2015-01-30 11:57   ` [PATCH] report-error: Catch un-readable log data Michael Wood
2015-02-03 14:20     ` [PATCH v2] " Michael Wood

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=1422549369-23245-1-git-send-email-michael.g.wood@intel.com \
    --to=michael.g.wood@intel.com \
    --cc=openembedded-core@lists.openembedded.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.