apport crashes when /etc/apport/native-origins.d contains any files.

Bug #865199 reported by Andreas Kostyrka
72
This bug affects 10 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
Low
Martin Pitt
Lucid
Fix Released
Low
Unassigned
Oneiric
Fix Released
Undecided
Unassigned

Bug Description

  File "/usr/lib/python2.6/dist-packages/apport/REThread.py", line 34, in run
    self._retval = self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.6/dist-packages/apport/ui.py", line 84, in thread_collect_info
    not apport.packaging.is_distro_package(report['Package'].split()[0])) \
  File "/usr/lib/python2.6/dist-packages/apport/packaging_impl.py", line 134, in is_distro_package
    for line in open(f):
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: 'firefox'

A short look at the source shows that os.listdir is used, but the directory path is not joined onto the open:

        try:
            for f in os.listdir('/etc/apport/native-origins.d'):
                for line in open(f):
                    line = line.strip()
                    if line:
                        native_origins.append(line)
        except OSError:
            pass

Now, this is wrong on a number of issues:
os.listdir returns only the basenames => so you need open(os.path.join("/etc/apport/native-origins.d", f))
Furthermore, open raises an IOError, so the OSError only catches issues with os.listdir, so if it should cover the open too, it should be: except (OSError, IOError): # notice the tuple.

Alternatively you can also use glob.glob("/etc/apport/native-origins.d/*"), that one includes the given path.

Package version: 1.13.3-0ubuntu2
Description: Ubuntu 10.04.3 LTS
Release: 10.04

Expected behaviour: Bug reporter should not crash.
What happened: apport crashed with a traceback.

I can also provide a fix as a patch if needed, but it's rather a trivial thing, packaging it up as a new package is probably more work, the detailed description how to fix is above.

Thanks, Andreas

Revision history for this message
Andreas Kostyrka (andreas-kostyrka) wrote :

As I said, it's not exactly huge, so I added the patch.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Fix for file open bug." of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
affects: ubuntu → apport (Ubuntu)
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks! I fixed it in trunk r1973, a bit differently (using globs and per-file exception catching).

Changed in apport (Ubuntu):
importance: Undecided → Low
status: New → Fix Committed
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.3 KiB)

This bug was fixed in the package apport - 1.24-0ubuntu1

---------------
apport (1.24-0ubuntu1) precise; urgency=low

  * New upstream release 1.23.1:
    - apport/crashdb.py: Ensure that duplicate table only has one entry per
      report ID.
    - apport-retrace: Pass correct executable path to gdb in --gdb with
      --sandbox mode.
    - apport-retrace: Do not leave behind temporary directories on errors.
    - apport-retrace: Drop assertion failure for existance of "Stacktrace".
      This isn't present in the case of gdb crashing, and there is not much we
      can do about it. This should not break the retracer.
    - apport/report.py: Unwind XError() from stack traces for the
      "StacktraceTop" field, as they take a significant part of the trace.
      This causes bugs to be duplicated which really have different causes.
  * New upstream release 1.24:
   - apport-retrace: Add --timestamp option to prepend a timestamp to log
     messages. This is useful for batch operations.
   - crash-digger: Call apport-retrace with --timestamps, to get consistent
     timestamps in log output.
   - hookutils.py: Add two new functions attach_gsettings_package() and
     attach_gsettings_schema() for adding user-modified gsettings keys to a
     report. (LP: #836489)
   - hookutils.py: Add new function in_session_of_problem() which returns
     whether the given report happened in the currently running XDG session.
     This can be used to determine if e. g. ~/.xsession-errors is relevant and
     should be attached.
   - backends/packaging-apt-dpkg.py, install_packages(): Also copy
     apt/sources.list.d/ into sandbox.
   - backends/packaging-apt-dpkg.py, install_packages(): Install apt keyrings
     from config dir or from system into sandbox. (LP: #856216)
   - packaging.py, backends/packaging-apt-dpkg.py: Define that
     install_packages() should return a SystemError for broken
     configs/unreachable servers etc., and fix the apt/dpkg implementation
     accordingly.
   - apport-retrace: Don't crash, just give a proper error message if servers
     are unreachable, or configuration files are broken. (LP: #859248)
   - backends/packaging-apt-dpkg.py: Fix crash when
     /etc/apport/native-origins.d contains any files. (LP: #865199)
   - hookutils, recent_logfile(): Fix invalid return value if log file is not
     readable. (LP: #819357)
   - test/crash: Fix race condition in the "second instance terminates
     immediately" check.
   - hookutils.py: Replace attach_gconf() with a no-op stub. It used static
     python modules like "gconf" which broke the PyGI GTK user interface, and
     gconf is rather obsolete these days.
   - ui.py, open_url(): Greatly simply and robustify by just using xdg-open.
     This already does the right thing wrt. reading the default browser from
     GNOME, KDE, XCE, and other desktops. (LP: #198449)
   - data/general-hooks/generic.py: Only attach ~/.xsession_errors if the bug
     is reported in the same XDG session as the crash happened. (LP: #869974)
   - Ignore crashes for programs which got updated in between the crash and
     reporting. (LP: #132904)
   - Special-case crashes of 'twistd': Try to determin...

Read more...

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Martin Pitt (pitti)
Changed in apport (Ubuntu Oneiric):
status: New → Fix Committed
Revision history for this message
Mike Doherty (doherty) wrote :

Can we get this fixed on lucid?

Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Andreas, or anyone else affected,

Accepted apport into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 1.23-0ubuntu4

---------------
apport (1.23-0ubuntu4) oneiric-proposed; urgency=low

  * apport-gtk: In bug update mode, make details dialog resizable and fix
    default size. Patch cherry-picked from trunk r1991. (LP: #865754)
  * backends/packaging-apt-dpkg.py: Fix crash when
    /etc/apport/native-origins.d contains any files. Patch cherry-picked from
    trunk r1973. (LP: #865199)
  * apport/report.py: Special-case crashes of 'twistd': Try to determine the
    client program and assign the report to that, or fail with an
    UnreportableReason. Patch cherry-picked from trunk r1989. (LP: #755025)
  * hookutils.py, attach_wifi(): Anonymize ESSID and AP MAC from "iwconfig"
    output. Patch cherry-picked from trunk 1993. (LP: #746900)
 -- Martin Pitt <email address hidden> Thu, 20 Oct 2011 12:08:11 +0200

Changed in apport (Ubuntu Oneiric):
status: Fix Committed → Fix Released
Revision history for this message
Jānis Kangarooo (kangarooo) wrote :

Still exists.
I have Bug 887321 in ubuntu netbook remix 10.04.03

Revision history for this message
mikewhatever (mikewhatever) wrote :

This bug was reported against 10.04, and is still unfixed. Is apport (1.23-0ubuntu4) going to be backported from Oneirc to Lucid?

Revision history for this message
Martin Pitt (pitti) wrote :

Lucid has been out for 1.5 years with this bug. I don't think it's important any more to fix it in lucid, but if there is some more demand (one or two more affected users speaking up), I can do a backport of the fix.

Revision history for this message
Martin Pitt (pitti) wrote :

Getting more dupes, presumably from people who run daily firefox PPA on lucid.

Changed in apport (Ubuntu Lucid):
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded to lucid-proposed, needs ubuntu-sru review now.

Changed in apport (Ubuntu Lucid):
assignee: Martin Pitt (pitti) → nobody
status: In Progress → Fix Committed
Revision history for this message
mikewhatever (mikewhatever) wrote :

Thanks Martin, really appreciate it.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hello Andreas, or anyone else affected,

Accepted apport into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Revision history for this message
michael37 (misha37) wrote :

Doesn't seem to work for me as I am still affected by bug 877848 which is supposedly a duplicate. Lucid 10.04.3 x86_64.

Get:1 http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive/ lucid-proposed/main apport 1.13.3-0ubuntu2.1 [54.8kB]
Fetched 54.8kB in 1s (31.5kB/s)
(Reading database ... 204744 files and directories currently installed.)
Preparing to replace apport 1.13.3-0ubuntu2 (using .../apport_1.13.3-0ubuntu2.1_all.deb) ...

$ ubuntu-bug apport
Traceback (most recent call last):
  File "/usr/share/apport/apport-gtk", line 368, in <module>
    app.run_argv()
  File "/usr/lib/python2.6/dist-packages/apport/ui.py", line 553, in run_argv
    return self.run_report_bug()
  File "/usr/lib/python2.6/dist-packages/apport/ui.py", line 369, in run_report_bug
    self.collect_info(symptom_script)
  File "/usr/lib/python2.6/dist-packages/apport/ui.py", line 769, in collect_info
    icthread.exc_raise()
  File "/usr/lib/python2.6/dist-packages/apport/REThread.py", line 34, in run
    self._retval = self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.6/dist-packages/apport/ui.py", line 84, in thread_collect_info
    not apport.packaging.is_distro_package(report['Package'].split()[0])) \
  File "/usr/lib/python2.6/dist-packages/apport/packaging_impl.py", line 134, in is_distro_package
    for line in open(f):
IOError: [Errno 2] No such file or directory: 'firefox'

Revision history for this message
Martin Pitt (pitti) wrote :

The fix is in the "python-apport" package, not "apport".

Revision history for this message
Silviu C. (silviucc) wrote :

Yes, the apport and related packs in proposed do indeed fix this.

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 1.13.3-0ubuntu2.1

---------------
apport (1.13.3-0ubuntu2.1) lucid-proposed; urgency=low

  * backends/packaging-apt-dpkg.py: Fix crash when
    /etc/apport/native-origins.d contains any files. Fix backported from
    upstream r1973. (LP: #865199)
 -- Martin Pitt <email address hidden> Wed, 16 Nov 2011 08:10:17 +0100

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.