Back to index

apport  2.3
Functions | Variables
generic Namespace Reference

Functions

def add_info

Variables

dictionary r = {}

Detailed Description

Attach generally useful information, not specific to any package.

Function Documentation

def generic.add_info (   report,
  ui 
)

Definition at line 18 of file generic.py.

00018 
00019 def add_info(report, ui):
00020     nm = apport.hookutils.nonfree_kernel_modules()
00021     if nm:
00022         report['NonfreeKernelModules'] = ' '.join(nm)
00023 
00024     # check for low space
00025     mounts = {'/': 'system',
00026               '/var': '/var',
00027               '/tmp': '/tmp'}
00028 
00029     home = os.getenv('HOME')
00030     if home:
00031         mounts[home] = 'home'
00032     treshold = 50
00033 
00034     for mount in mounts:
00035         st = os.statvfs(mount)
00036         free_mb = st.f_bavail * st.f_frsize / 1000000
00037 
00038         if free_mb < treshold:
00039             report['UnreportableReason'] = 'Your %s partition has less than \
00040 %s MB of free space available, which leads to problems using applications \
00041 and installing updates. Please free some space.' % (mounts[mount], free_mb)
00042 
00043     # important glib errors/assertions (which should not have private data)
00044     if 'ExecutablePath' in report:
00045         path = report['ExecutablePath']
00046         gtk_like = (apport.hookutils.links_with_shared_library(path, 'libgtk') or
00047                     apport.hookutils.links_with_shared_library(path, 'libgtk-3') or
00048                     apport.hookutils.links_with_shared_library(path, 'libX11'))
00049         if gtk_like and apport.hookutils.in_session_of_problem(report):
00050             xsession_errors = apport.hookutils.xsession_errors()
00051             if xsession_errors:
00052                 report['XsessionErrors'] = xsession_errors
00053 
00054     # using local libraries?
00055     if 'ProcMaps' in report:
00056         local_libs = set()
00057         for lib in re.finditer(r'\s(/[^ ]+\.so[.0-9]*)$', report['ProcMaps'], re.M):
00058             if not apport.fileutils.likely_packaged(lib.group(1)):
00059                 local_libs.add(lib.group(1))
00060         if local_libs:
00061             if not ui.yesno('''The crashed program seems to use third-party or local libraries:
00062 
00063 %s
00064 
00065 It is highly recommended to check if the problem persists without those first.
00066 
00067 Do you want to continue the report process anyway?
00068 ''' % '\n'.join(local_libs)):
00069                 raise StopIteration
00070             report['LocalLibraries'] = ' '.join(local_libs)
00071             report['Tags'] = (report.get('Tags', '') + ' local-libs').strip()
00072 
00073     # using third-party packages?
00074     if '[origin:' in report.get('Package', '') or '[origin:' in report.get('Dependencies', ''):
00075         report['Tags'] = (report.get('Tags', '') + ' third-party-packages').strip()
00076 
00077     # using ecryptfs?
00078     if os.path.exists(os.path.expanduser('~/.ecryptfs/wrapped-passphrase')):
00079         report['EcryptfsInUse'] = 'Yes'
00080 
00081     # filter out crashes on missing GLX (LP#327673)
00082     in_gl = '/usr/lib/libGL.so' in (report.get('StacktraceTop') or '\n').splitlines()[0]
00083     if in_gl and 'Loading extension GLX' not in apport.hookutils.read_file('/var/log/Xorg.0.log'):
00084         report['UnreportableReason'] = 'The X.org server does not support the GLX extension, which the crashed program expected to use.'
00085     # filter out package install failures due to a segfault
00086     if 'Segmentation fault' in report.get('ErrorMessage', '') \
00087             and report['ProblemType'] == 'Package':
00088         report['UnreportableReason'] = 'The package installation resulted in a segmentation fault which is better reported as a crash report rather than a package install failure.'
00089 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

dictionary generic.r = {}

Definition at line 91 of file generic.py.