Crash when hooks add file references: AttributeError: 'tuple' object has no attribute 'splitlines'

Bug #205163 reported by t.haarhuis on 2008-03-22
46
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Medium
Martin Pitt

Bug Description

Binary package hint: apport

I was busy with a new installation under vmware..
it was bussy displaying the disk partitions, but it didn't show any partitions, and suddenly something crashed...

ProblemType: Crash
Architecture: i386
CrashReports:
 600:0:0:45572:2008-03-22 15:37:26.517460000 +0000:2008-03-22 15:37:27.517460000 +0000:/var/crash/_usr_lib_ubiquity_bin_ubiquity.0.crash
 600:0:0:23878:2008-03-22 15:37:27.017488000 +0000:2008-03-22 15:37:28.017488000 +0000:/var/crash/_usr_share_apport_apport-qt.0.crash
Date: Sat Mar 22 15:37:27 2008
DistroRelease: Ubuntu 7.10
ExecutablePath: /usr/share/apport/apport-qt
InterpreterPath: /usr/bin/python2.5
Package: apport-qt 0.98
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/share/apport/apport-qt
ProcCwd: /home/ubuntu
ProcEnviron:
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
 LANG=en_US.UTF-8
PythonArgs: ['/usr/share/apport/apport-qt']
SourcePackage: apport
Title: apport-qt crashed with AttributeError in ui_present_report_details()
Uname: Linux ubuntu 2.6.22-14-generic #1 SMP Wed Oct 10 06:00:47 GMT 2007 i686 GNU/Linux

ERROR:
Traceback (most recent call last):
  File "/usr/share/apport/apport-qt", line 317, in <module>
    app.run_argv()
  File "/var/lib/python-support/python2.5/apport/ui.py", line 260, in run_argv
    self.run_crashes()
  File "/var/lib/python-support/python2.5/apport/ui.py", line 101, in run_crashes
    self.run_crash(f)
  File "/var/lib/python-support/python2.5/apport/ui.py", line 192, in run_crash
    response = self.ui_present_report_details()
  File "/usr/share/apport/apport-qt", line 227, in ui_present_report_details
    lines = self.report[key].splitlines()
AttributeError: 'tuple' object has no attribute 'splitlines'

t.haarhuis (t-haarhuis) wrote :
Daniel Hahler (blueyed) on 2008-04-10
description: updated
Daniel Hahler (blueyed) wrote :

Thank you for your bug report.

Actually, this crash is a crash of the crash reporter (apport) itself.

Please attach the crash file for the vmware crash itself to this bug report here. Hopefully it's in /var/crash/.

Now analyzing..
This is similar to bug 84196, which had been fixed for Feisty (bzr revno 566).
But in bzr revno 979 this appears to have regressed. It does not check for attribute "splitlines" anymore, but if it has no attribute "gzipvalue" and is not binary data.

Given a tuple, this does not have an attribute "gzipvalue" and depending on its values, _is_binary will return False.

The code in question (in Ubuntu Hardy) is:
            # string value
            if not hasattr(self.report[key], 'gzipvalue') and not self.report._is_binary(self.report[key]):
                lines = self.report[key].splitlines()
                for line in lines:
                    QTreeWidgetItem(keyitem, [line])
                if len(lines) < 4:
                    keyitem.setExpanded(True)
            else:
                QTreeWidgetItem (keyitem, [_('(binary data)')])

And _is_binary, which should probably check if the given data is actually a string?!
    def _is_binary(self, string):
        '''Check if the given strings contains binary data.'''

        for c in string:
            if c < ' ' and not c.isspace():
                return True
        return False

Changed in apport:
importance: Undecided → Medium
status: New → Triaged

Please remove me from your list

The only constant in the universe is change!

----- Original Message ----
From: Daniel Hahler <email address hidden>
To: <email address hidden>
Sent: Thursday, April 10, 2008 5:01:28 PM
Subject: [Bug 205163] Re: failed to create disk partitions under vmware

Thank you for your bug report.

Actually, this crash is a crash of the crash reporter (apport) itself.

Please attach the crash file for the vmware crash itself to this bug
report here. Hopefully it's in /var/crash/.

Now analyzing..
This is similar to bug 84196, which had been fixed for Feisty (bzr revno 566).
But in bzr revno 979 this appears to have regressed. It does not check for attribute "splitlines" anymore, but if it has no attribute "gzipvalue" and is not binary data.

Given a tuple, this does not have an attribute "gzipvalue" and depending
on its values, _is_binary will return False.

The code in question (in Ubuntu Hardy) is:
            # string value
            if not hasattr(self.report[key], 'gzipvalue') and not self.report._is_binary(self.report[key]):
                lines = self.report[key].splitlines()
                for line in lines:
                    QTreeWidgetItem(keyitem, [line])
                if len(lines) < 4:
                    keyitem.setExpanded(True)
            else:
                QTreeWidgetItem (keyitem, [_('(binary data)')])

And _is_binary, which should probably check if the given data is actually a string?!
    def _is_binary(self, string):
        '''Check if the given strings contains binary data.'''

        for c in string:
            if c < ' ' and not c.isspace():
                return True
        return False

** Changed in: apport (Ubuntu)
   Importance: Undecided => Medium
       Status: New => Triaged

** Summary changed:

- failed to create disk partitions under vmware
+ Regression in apport-qt: AttributeError: 'tuple' object has no attribute 'splitlines'

--
Regression in apport-qt: AttributeError: 'tuple' object has no attribute 'splitlines'
https://bugs.launchpad.net/bugs/205163
You received this bug notification because you are a direct subscriber
of a duplicate bug.

Ah, I bet that crash report has a reference to an external files, which are stored as tuples.

Changed in apport:
assignee: nobody → pitti
status: Triaged → In Progress
Martin Pitt (pitti) wrote :

Fixed in trunk.

Changed in apport:
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 0.108

---------------
apport (0.108) hardy; urgency=low

  [ Martin Pitt ]
  * apport-{gtk,qt,cli}: Fix handling of file references added by package
    hooks. (LP: #205163)
  * backends/packaging_rpm.py: Fix dependency resolution of uname(*) in the
    RPM backend. Thanks to Patryk Zawadzki! (LP: #213018)
  * backends/packaging_rpm.py: Fix RPM platform parsing, thanks to Patryk
    Zawadzki! (LP: #213015)
  * po/de.po: Fix typo (missing space).
  * debian/apport.default: Disable Apport for the final Hardy release, since
    it is less useful in stable releases, and drains a lot of CPU and I/O
    power on crashes. Disabling it here instead of in update-notifier/adept is
    more discoverable and more centralized.

  [ Daniel Hahler ]
  * bin/apport-retrace: catch the same exceptions from Report.load() like
    ui.load_report() does (LP: #211899)
  * Fix uncaught exceptions in apport itself (LP: #215929):
    - apport/REThread.py: check if "sys" exists in the except block of
      REThread.run()
    - apport_python_hook.py: check if "sys" exists in the finally block of
      apport_excepthook
  * cli/apport-cli: Fix UnboundLocalError in ui_present_crash, which rendered
    apport-cli useless (for reporting crashes) (LP: #216151)

 -- Martin Pitt <email address hidden> Wed, 16 Apr 2008 12:24:32 +0200

Changed in apport:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers