/usr/share/apport/package-hooks/mountall.py is in mountall 2.54ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #!/usr/bin/python3
'''
Mountall apport hook.
'''
import os
from apport.hookutils import *
import apport.packaging
import glob
msg = \
"""
The contents of your /etc/fstab file and relevant log files may help
developers diagnose your bug more quickly. However, if you have modified
/etc/fstab, these files may contain sensitive information.
Do you want to include the files in your bug report? (you will be able
to review the data before it is sent)
"""
def add_root_file(map, file):
"""
Add @file to @map such that @map can be passed to
attach_root_command_outputs() to have @file attached to the report
event if it is unreadable by the current user.
"""
if not os.path.exists(file):
return
key = path_to_key(file)
map[key] = 'cat %s' % file
def add_info(report, ui):
attach_files = False
# files that are not readable by current user
unreadable_files = {}
problem_type = report.get('ProblemType', '')
if problem_type == 'Bug' and ui:
if ui.yesno(msg) == None:
raise StopIteration
attach_files = True
elif problem_type == 'Crash':
# crash bugs are private by default
attach_files = True
if attach_files == False:
return
attach_file(report, '/etc/fstab')
attach_file(report, '/etc/mtab')
attach_file(report, '/proc/cmdline', 'ProcKernelCmdline')
attach_file(report, '/proc/mounts', 'ProcMounts')
attach_file(report, '/proc/self/mountinfo', 'ProcSelfMountinfo')
attach_file_if_exists(report, '/run/mount/utab')
report['Mounts'] = apport.hookutils.command_output(['mount'])
# mountall logs to the console so until Upstart can log to both the
# console and a file, grab the plymouth log which captures the
# console.
add_root_file(unreadable_files, '/var/log/boot.log')
# in case admin changed the console stanza
add_root_file(unreadable_files, '/var/log/upstart/mountall.log')
attach_root_command_outputs(report, unreadable_files)
|