~ubuntu-core-dev/ubuntu/maverick/apport/ubuntu

« back to all changes in this revision

Viewing changes to data/general-hooks/generic.py

  • Committer: Colin Watson
  • Date: 2010-02-10 14:44:12 UTC
  • mfrom: (1621 ubuntu)
  • mto: This revision was merged to the branch mainline in revision 1622.
  • Revision ID: cjwatson@canonical.com-20100210144412-l51zdyocvb376468
mergeĀ fromĀ lucid

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
'''Attach generally useful information, not specific to any package.
2
 
 
3
 
Copyright (C) 2009 Canonical Ltd.
4
 
Author: Matt Zimmerman <mdz@canonical.com>
5
 
 
6
 
This program is free software; you can redistribute it and/or modify it
7
 
under the terms of the GNU General Public License as published by the
8
 
Free Software Foundation; either version 2 of the License, or (at your
9
 
option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
10
 
the full text of the license.
11
 
'''
 
1
'''Attach generally useful information, not specific to any package.'''
 
2
 
 
3
# Copyright (C) 2009 Canonical Ltd.
 
4
# Authors: Matt Zimmerman <mdz@canonical.com>
 
5
#          Martin Pitt <martin.pitt@ubuntu.com>
 
6
 
7
# This program is free software; you can redistribute it and/or modify it
 
8
# under the terms of the GNU General Public License as published by the
 
9
# Free Software Foundation; either version 2 of the License, or (at your
 
10
# option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
 
11
# the full text of the license.
12
12
 
13
13
import os, re
14
14
import apport.hookutils
35
35
free some space.' % (mounts[mount], free_mb)
36
36
 
37
37
    # important glib errors/assertions (which should not have private data)
38
 
    xsession_errors = ''
39
 
    xsession_errors_path = os.path.join(home, '.xsession-errors')
40
 
    if os.path.exists(xsession_errors_path):
41
 
        filter = re.compile('^(\(.*:\d+\): \w+-(WARNING|CRITICAL|ERROR))|(Error: .*No Symbols named)')
42
 
        for line in open(xsession_errors_path):
43
 
            if filter.match(line):
44
 
                xsession_errors += line
45
 
    if xsession_errors:
46
 
        report['XsessionErrors'] = xsession_errors
 
38
    if 'ExecutablePath' in report:
 
39
        path = report['ExecutablePath']
 
40
        if (apport.hookutils.links_with_shared_library(path, 'libgtk') or
 
41
            apport.hookutils.links_with_shared_library(path, 'libX11')):
 
42
 
 
43
            pattern = re.compile('^(\(.*:\d+\): \w+-(WARNING|CRITICAL|ERROR))|(Error: .*No Symbols named)')
 
44
            xsession_errors = apport.hookutils.xsession_errors(pattern)
 
45
            if xsession_errors:
 
46
                report['XsessionErrors'] = xsession_errors
 
47
 
 
48
    # using ecryptfs?
 
49
    if os.path.exists(os.path.expanduser('~/.ecryptfs/wrapped-passphrase')):
 
50
        report['EcryptfsInUse'] = 'Yes'
 
51
 
 
52
    # filter out crashes on missing GLX (LP#327673)
 
53
    if '/usr/lib/libGL.so' in report.get('StacktraceTop', '\n').splitlines()[0] \
 
54
        and 'Loading extension GLX' not in apport.hookutils.read_file('/var/log/Xorg.0.log'):
 
55
            report['UnreportableReason'] = 'The X.org server does not support the GLX extension, which the crashed program expected to use.'
 
56
 
47
57
 
48
58
if __name__ == '__main__':
49
59
    r = {}