diff mbox

report-error: replace build paths with markers not whitespace

Message ID 1468316570-26620-1-git-send-email-ross.burton@intel.com
State Accepted
Commit 95794e261628f83ddab0aa7b8bafb6409cc9deb5
Headers show

Commit Message

Ross Burton July 12, 2016, 9:42 a.m. UTC
To remove potentially personal information and reduce irrelevant noise when
searching for similar reports the error reporting class removes ${TOPDIR} from
the logs.  Whilst this is valid intention, the replacement of ' ' results in
potentially confusing logs as it appears that builds are happening in /tmp, or
whitespace can appear in places where it isn't allowed which can look like a
bug.

Solve both of these by replacing the value of TOPDIR with the literal string
TOPDIR.

Also replace TMPDIR after TOPDIR, as it's not uncommon to have TMPDIR somewhere
other than directly under TOPDIR.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/classes/report-error.bbclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
2.8.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Khem Raj July 12, 2016, 11:28 p.m. UTC | #1
On Tue, Jul 12, 2016 at 2:42 AM, Ross Burton <ross.burton@intel.com> wrote:
> To remove potentially personal information and reduce irrelevant noise when

> searching for similar reports the error reporting class removes ${TOPDIR} from

> the logs.  Whilst this is valid intention, the replacement of ' ' results in

> potentially confusing logs as it appears that builds are happening in /tmp, or

> whitespace can appear in places where it isn't allowed which can look like a

> bug.

>

> Solve both of these by replacing the value of TOPDIR with the literal string

> TOPDIR.

>

> Also replace TMPDIR after TOPDIR, as it's not uncommon to have TMPDIR somewhere

> other than directly under TOPDIR.

>

> Signed-off-by: Ross Burton <ross.burton@intel.com>


Tested-By: Khem Raj <raj.khem@gmail.com>


> ---

>  meta/classes/report-error.bbclass | 8 +++++---

>  1 file changed, 5 insertions(+), 3 deletions(-)

>

> diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass

> index 5cbf8f0..c8c15bd 100644

> --- a/meta/classes/report-error.bbclass

> +++ b/meta/classes/report-error.bbclass

> @@ -59,9 +59,11 @@ python errorreport_handler () {

>                      logFile = codecs.open(log, 'r', 'utf-8')

>                      logdata = logFile.read()

>

> -                    topdir = e.data.getVar('TOPDIR', True)

> -                    if topdir:

> -                        logdata = logdata.replace(topdir, ' ')

> +                    # Replace host-specific paths so the logs are cleaner

> +                    for d in ("TOPDIR", "TMPDIR"):

> +                        s = e.data.getVar(d, True)

> +                        if s:

> +                            logdata = logdata.replace(s, d)

>

>                      logFile.close()

>                  except:

> --

> 2.8.1

>

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox

Patch

diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 5cbf8f0..c8c15bd 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -59,9 +59,11 @@  python errorreport_handler () {
                     logFile = codecs.open(log, 'r', 'utf-8')
                     logdata = logFile.read()
 
-                    topdir = e.data.getVar('TOPDIR', True)
-                    if topdir:
-                        logdata = logdata.replace(topdir, ' ')
+                    # Replace host-specific paths so the logs are cleaner
+                    for d in ("TOPDIR", "TMPDIR"):
+                        s = e.data.getVar(d, True)
+                        if s:
+                            logdata = logdata.replace(s, d)
 
                     logFile.close()
                 except: