← Back to team overview

desktop-packages team mailing list archive

[Bug 1370259] Re: apport fails to collect nvram specific information -- attach_root_command_outputs() does not work for binary data

 

This bug was fixed in the package apport - 2.14.7-0ubuntu8.1

---------------
apport (2.14.7-0ubuntu8.1) utopic-proposed; urgency=medium

  * hookutils, attach_root_command_outputs(): Fix UnicodeDecodeError crash for
    non-textual values. Cherry-picked from trunk r2890. (LP: #1370259)
 -- Martin Pitt <martin.pitt@xxxxxxxxxx>   Thu, 08 Jan 2015 11:23:53 +0100

** Changed in: apport (Ubuntu Utopic)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to apport in Ubuntu.
https://bugs.launchpad.net/bugs/1370259

Title:
  apport fails to collect nvram specific information --
  attach_root_command_outputs() does not work for binary data

Status in apport package in Ubuntu:
  Fix Released
Status in apport source package in Utopic:
  Fix Released

Bug description:
  ---Problem Description---
  apport fails to collect nvram specific information
   
  ---uname output---
  3.16.0-10-generic
   
  Machine Type = POWER8 
    
  ---Steps to Reproduce---
   
  1) Install Ubuntu 14.10 in Power non-virtualized environment.
  2) Install apport package
  3) Run following command to verify if apport collects power specific information.

     apport-cli -f -p linux-generic --save=/home/sachin/linux.apport

  The command fails with following error :

  root@lep8d:/home/sachin# apport-cli -f -p linux-generic
  --save=/home/sachin/linux.apport

  *** Collecting problem information

  The collected information can be sent to the developers to improve the
  application. This might take a few minutes.
  .......tar: Removing leading `/' from member names
  ....ERROR: hook /usr/share/apport/general-hooks/powerpc.py crashed:
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/apport/report.py", line 197, in _run_hook
      symb['add_info'](report, ui)
    File "/usr/share/apport/general-hooks/powerpc.py", line 72, in add_info
      'nvram': 'cat /dev/nvram',
    File "/usr/lib/python3/dist-packages/apport/hookutils.py", line 469, in attach_root_command_outputs
      buf = f.read().strip()
    File "/usr/lib/python3.4/codecs.py", line 313, in decode
      (result, consumed) = self._buffer_decode(data, self.errors, final)
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
  ...
  root@lep8d:/home/sachin# 
   
  Userspace tool common name: apport 
   
  Following version of apport is installed.

  root@lep8d:/home/sachin# dpkg --list | grep apport
  ii  apport                                                 2.14.7-0ubuntu1                            all          automatically generate crash reports for debugging
  ii  apport-symptoms                                        0.20                                       all          symptom scripts for apport
  ii  python-apport                                          2.14.7-0ubuntu1                            all          Python library for Apport crash report handling
  ii  python3-apport                                         2.14.7-0ubuntu1                            all          Python 3 library for Apport crash report handling
  root@lep8d:/home/sachin#

  Looking at the code we are doing a cat /dev/nvram to the apport output file which doesn't sounds right to me. I would think using the function add_tar() creating a tar file and copying the content as a ascii file at end of apport output file more appropriate.
  One dummy question remaining, how getting the tar file from the ascii output file if we need to ? ( that's also true to validate the content of the DeviceTree tar file).

  Would suggest following patch:
  --- powerpc.py	2014-09-10 10:28:18.824002770 -0400
  +++ powerpc.py.old	2014-09-04 06:33:16.000000000 -0400
  @@ -69,8 +69,8 @@
                   'cpu_runmode': 'ppc64_cpu --run-mode',
                   'cpu_freq': 'ppc64_cpu --frequency',
                   'cpu_dscr': 'ppc64_cpu --dscr',
  +                'nvram': 'cat /dev/nvram',
               })
  -            add_tar(report, '/dev/nvram', 'nvram.tar')
           attach_file_if_exists(report, '/var/log/platform')
   
       if ispSeries and not isPowerKVM:

  thanks
   diff -urN powerpc.py.old powerpc.py 
  --- powerpc.py.old	2014-09-04 06:33:16.000000000 -0400
  +++ powerpc.py	2014-09-10 10:28:18.824002770 -0400
  @@ -69,8 +69,8 @@
                   'cpu_runmode': 'ppc64_cpu --run-mode',
                   'cpu_freq': 'ppc64_cpu --frequency',
                   'cpu_dscr': 'ppc64_cpu --dscr',
  -                'nvram': 'cat /dev/nvram',
               })
  +            add_tar(report, '/dev/nvram', 'nvram.tar')
           attach_file_if_exists(report, '/var/log/platform')
   
       if ispSeries and not isPowerKVM:

  Initial Launchpad bug id #1336462 implemented feature support

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1370259/+subscriptions