File manager - Edit - /var/www/payraty/helpdesk/public/storage/branding_media/images/apport.zip
Back
PK ! �#�%� � blacklist.d/README.blacklistnu �[��� # Blacklist for apport # If an executable path appears on any line in any file in # /etc/apport/blacklist.d/, apport will not generate a crash report # for it. Matches are exact only at the moment (no globbing etc.). PK ! �!�� blacklist.d/apportnu �[��� /usr/bin/wine-preloader PK ! (tG� � crashdb.confnu �[��� # map crash database names to CrashDatabase implementations and URLs default = 'ubuntu' def get_oem_project(): '''Determine OEM project name from Distribution Channel Descriptor Return None if it cannot be determined or does not exist. ''' try: dcd = open('/var/lib/ubuntu_dist_channel').read() if dcd.startswith('canonical-oem-'): return dcd.split('-')[2] except IOError: return None databases = { 'ubuntu': { 'impl': 'launchpad', 'bug_pattern_url': 'http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml', 'dupdb_url': 'http://people.canonical.com/~ubuntu-archive/apport-duplicates', 'distro': 'ubuntu', 'problem_types': ['Bug', 'Package'], 'escalation_tag': 'bugpattern-needed', 'escalated_tag': 'bugpattern-written', }, 'canonical-oem': { 'impl': 'launchpad', 'bug_pattern_url': 'http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml', 'project': get_oem_project(), }, 'debug': { # for debugging 'impl': 'memory', 'bug_pattern_url': '/tmp/bugpatterns.xml', 'distro': 'debug' }, } PK ! B3� � � testsuite/crash.classnu �[��� ��� 2 <init> ()V Code LineNumberTable main ([Ljava/lang/String;)V SourceFile crash.java java/lang/RuntimeException Can't catch this crash java/lang/Object 0com/ubuntu/apport/ApportUncaughtExceptionHandler install (Ljava/lang/String;)V *� � ) � � Y� � PK ! d*�� � testsuite/crash.jarnu �[��� PK ({�Z META-INF/�� PK ({�Z META-INF/MANIFEST.MF�M��LK-.� K-*��ϳR0�3��r.JM,IM�u� E�,4B�J�JJ5y�x� PK��߱6 7 PK ({�Z crash.classmPAK�0}Y�u����M���y��UDC�� ��,�m:�T�[�& z�G�_�l����K�|��8 kh:X/cÅ�����M�҉�ʜ2X��C�<I��@iy�F�L�S������`�r=��&Qz|��a�&B^�L슄ς�LXE[Ul���Y�oSmT$/^��Sx��=�܈�k5��;���ƟHaEy�OQ�ǧ�81�Y�Z�t�E�ףP&��3�Ð���tQ��F�&=�U����ޟ��R��Bk)'-�UQ���i���7>`=6�s�_��'�$�̫�M�_PKB3� 7 � PK ({�Z META-INF/�� PK ({�Z��߱6 7 + META-INF/MANIFEST.MFPK ({�ZB3� 7 � � crash.classPK � PK ! fJ` ` root_info_wrappernu ȯ�� #!/bin/sh # this wrapper just exists so that we can put a polkit .policy around it exec sh "$@" PK ! �P�� � kernel_oopsnu ȯ�� #!/usr/bin/python3 # # Collect information about a kernel oops. # # Copyright (c) 2008 Canonical Ltd. # Author: Matt Zimmerman <mdz@canonical.com> # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. See http://www.gnu.org/copyleft/gpl.html for # the full text of the license. import os import sys import apport.fileutils from apport import unicode_gettext as _ checksum = None if len(sys.argv) > 1: checksum = sys.argv[1] oops = sys.stdin.read() pr = apport.Report('KernelOops') pr['Failure'] = 'oops' pr['Tags'] = 'kernel-oops' pr['Annotation'] = _('Your system might become unstable ' 'now and might need to be restarted.') package = apport.packaging.get_kernel_package() pr.add_package(package) pr['SourcePackage'] = 'linux' pr['OopsText'] = oops u = os.uname() pr['Uname'] = '%s %s %s' % (u[0], u[2], u[4]) # write report try: with apport.fileutils.make_report_file(pr, uid=checksum) as f: pr.write(f) except (IOError, OSError) as e: apport.fatal('Cannot create report: ' + str(e)) PK ! ��q�� � package-hooks/source_shadow.pynu �[��� #!/usr/bin/python '''Apport package hook for shadow (c) 2010 Canonical Ltd. Contributors: Marc Deslauriers <marc.deslauriers@canonical.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from apport.hookutils import * def add_info(report): attach_file_if_exists(report, '/etc/login.defs', 'LoginDefs') if __name__ == '__main__': report = {} add_info(report) for key in report: print('[%s]\n%s' % (key, report[key])) PK ! ���# # package-hooks/vsftpd.pynu �[��� #!/usr/bin/python '''apport hook for vsftpd (c) 2010 Andres Rodriguez. Author: Andres Rodriguez <andreserl@ubuntu.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from apport.hookutils import * def add_info(report, ui): response = ui.yesno("The contents of your /etc/vsftpd.conf file " "may help developers diagnose your bug more " "quickly. However, it may contain sensitive " "information. Do you want to include it in your " "bug report?") if response == None: # user cancelled raise StopIteration elif response == True: attach_conffiles(report,'vsftpd') attach_file_if_exists(report, os.path.expanduser('/var/log/vsftpd.log'), 'vsftpd.log') PK ! �S� � package-hooks/source_linux.pynu �[��� '''Apport package hook for the Linux kernel. (c) 2008 Canonical Ltd. Contributors: Matt Zimmerman <mdz@canonical.com> Martin Pitt <martin.pitt@canonical.com> Brian Murray <brian@canonical.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' import os.path, re import apport import apport.hookutils SUBMIT_SCRIPT = "/usr/bin/kerneloops-submit" def add_info(report, ui): # If running an upstream kernel, instruct reporter to file bug upstream abi = re.search("-(.*?)-", report['Uname']) if abi and (abi.group(1) == '999' or re.search("^0\\d", abi.group(1))): ui.information("It appears you are currently running a mainline kernel. It would be better to report this bug upstream at http://bugzilla.kernel.org/ so that the upstream kernel developers are aware of the issue. If you'd still like to file a bug against the Ubuntu kernel, please boot with an official Ubuntu kernel and re-file.") report['UnreportableReason'] = 'The running kernel is not an Ubuntu kernel' return version_signature = report.get('ProcVersionSignature', '') if not version_signature.startswith('Ubuntu ') and 'CrashDB' not in report: report['UnreportableReason'] = 'The running kernel is not an Ubuntu kernel' return # Prevent reports against the linux-meta and linux-signed families, redirect to the main package. for src_pkg in ['linux-meta', 'linux-signed']: if report['SourcePackage'].startswith(src_pkg): report['SourcePackage'] = report['SourcePackage'].replace(src_pkg, 'linux', 1) report.setdefault('Tags', '') # Tag up back ported kernel reports for easy identification if report['SourcePackage'].startswith('linux-lts-'): report['Tags'] += ' qa-kernel-lts-testing' apport.hookutils.attach_hardware(report) apport.hookutils.attach_alsa(report) apport.hookutils.attach_wifi(report) apport.hookutils.attach_file(report, '/proc/fb', 'ProcFB') staging_drivers = re.findall("(\\w+): module is from the staging directory", report['CurrentDmesg']) if staging_drivers: staging_drivers = list(set(staging_drivers)) report['StagingDrivers'] = ' '.join(staging_drivers) report['Tags'] += ' staging' # Only if there is an existing title prepend '[STAGING]'. # Changed to prevent bug titles with just '[STAGING] '. if report.get('Title'): report['Title'] = '[STAGING] ' + report.get('Title') apport.hookutils.attach_file_if_exists(report, "/etc/initramfs-tools/conf.d/resume", key="HibernationDevice") uname_release = os.uname()[2] lrm_package_name = 'linux-restricted-modules-%s' % uname_release lbm_package_name = 'linux-backports-modules-%s' % uname_release apport.hookutils.attach_related_packages(report, [lrm_package_name, lbm_package_name, 'linux-firmware']) if ('Failure' in report and report['Failure'] == 'oops' and 'OopsText' in report and os.path.exists(SUBMIT_SCRIPT)): # tag kerneloopses with the version of the kerneloops package apport.hookutils.attach_related_packages(report, ['kerneloops-daemon']) oopstext = report['OopsText'] dupe_sig1 = None dupe_sig2 = None for line in oopstext.splitlines(): if line.startswith('BUG:'): bug = re.compile('at [0-9a-f]+$') dupe_sig1 = bug.sub('at location', line) rip = re.compile('^[RE]?IP:') if re.search(rip, line): loc = re.compile('\\[<[0-9a-f]+>\\]') dupe_sig2 = loc.sub('location', line) if dupe_sig1 and dupe_sig2: report['DuplicateSignature'] = '%s %s' % (dupe_sig1, dupe_sig2) # it's from kerneloops, ask the user whether to submit there as well if ui: # Some OopsText begin with "--- [ cut here ] ---", so remove it oopstext = re.sub("---.*\n", "", oopstext) first_line = re.match(".*\n", oopstext) ip = re.search("(R|E)?IP\\:.*\n", oopstext) kernel_driver = re.search("(R|E)?IP(:| is at) .*\\[(.*)\\]\n", oopstext) call_trace = re.search("Call Trace(.*\n){,10}", oopstext) oops = '' if first_line: oops += first_line.group(0) if ip: oops += ip.group(0) if call_trace: oops += call_trace.group(0) if kernel_driver: report['Tags'] += ' kernel-driver-%s' % kernel_driver.group(3) # 2012-01-13 - disable submission question as kerneloops.org is # down # if ui.yesno("This report may also be submitted to " # "http://kerneloops.org/ in order to help collect aggregate " # "information about kernel problems. This aids in identifying " # "widespread issues and problematic areas. A condensed " # "summary of the Oops is shown below. Would you like to submit " # "information about this crash to kerneloops.org?" # "\n\n%s" % oops): # text = report['OopsText'] # proc = subprocess.Popen(SUBMIT_SCRIPT, stdin=subprocess.PIPE) # proc.communicate(text) elif 'Failure' in report and ('resume' in report['Failure'] or 'suspend' in report['Failure']): crash_signature = report.crash_signature() if crash_signature: report['DuplicateSignature'] = crash_signature if report.get('ProblemType') == 'Package': # in case there is a failure with a grub script apport.hookutils.attach_related_packages(report, ['grub-pc']) if __name__ == '__main__': r = apport.Report() r.add_proc_info() r.add_os_info() r['ProcVersionSignature'] = 'Ubuntu 3.4.0' add_info(r, None) for k, v in r.items(): print('%s: %s' % (k, v)) PK ! ��{� � + package-hooks/source_unattended-upgrades.pynu �[��� """ unattended-upgrades apport hook Collects the following log file: - /var/log/unattended-upgrades/unattended-upgrades.log Check to see if either of these conffiles has been modified: - /etc/apt/apt.conf.d/50unattended-upgrades - /etc/apt/apt.conf.d/10periodic """ from apport.hookutils import ( attach_conffiles, attach_file_if_exists) def add_info(report, ui): # always attach these files attach_conffiles(report, 'unattended-upgrades', ui=ui) attach_conffiles(report, 'update-notifier-common', ui=ui) attach_file_if_exists( report, '/var/log/unattended-upgrades/unattended-upgrades.log') attach_file_if_exists( report, '/var/log/apt/history.log') PK ! �B��� � # package-hooks/source_shim-signed.pynu �[��� '''apport package hook for shim and shim-signed (c) 2015 Canonical Ltd. Author: Brian Murray <brian@ubuntu.com> ''' import errno import os import re from apport.hookutils import ( command_available, command_output, recent_syslog, attach_file, attach_root_command_outputs) efiarch = {'amd64': 'x64', 'i386': 'ia32', 'arm64': 'aa64' } grubarch = {'amd64': 'x86_64', 'i386': 'i386', 'arm64': 'arm64' } def add_info(report, ui): efiboot = '/boot/efi/EFI/ubuntu' if command_available('efibootmgr'): report['EFIBootMgr'] = command_output(['efibootmgr', '-v']) else: report['EFIBootMgr'] = 'efibootmgr not available' commands = {} try: directory = os.stat(efiboot) except OSError as e: if e.errno == errno.ENOENT: report['Missing'] = '/boot/efi/EFI/ubuntu directory is missing' return if e.errno == errno.EACCES: directory= True if directory: arch = report['Architecture'] commands['BootEFIContents'] = 'ls %s' % efiboot commands['ShimDiff'] = 'diff %s/shim%s.efi /usr/lib/shim/shim%s.efi.signed' % (efiboot, efiarch[arch], efiarch[arch]) commands['GrubDiff'] = 'diff %s/grub%s.efi /usr/lib/grub/%s-efi-signed/grub%s.efi.signed' %(efiboot, efiarch[arch], grubarch[arch], efiarch[arch]) efivars_dir = '/sys/firmware/efi/efivars' sb_var = os.path.join(efivars_dir, 'SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c') mok_var = os.path.join(efivars_dir, 'MokSBStateRT-605dab50-e046-4300-abb6-3dd810dd8b23') attach_file(report, '/proc/sys/kernel/moksbstate_disabled') commands['SecureBoot'] = 'od -An -t u1 %s' % sb_var commands['MokSBStateRT'] = 'od -An -t u1 %s' % mok_var attach_root_command_outputs(report, commands) report['EFITables'] = recent_syslog(re.compile(r'(efi|esrt):|Secure boot')) PK ! a��|� � package-hooks/source_sudo.pynu �[��� #!/usr/bin/python3 '''Apport package hook for sudo (c) 2010 Canonical Ltd. Contributors: Marc Deslauriers <marc.deslauriers@canonical.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from apport.hookutils import * def add_info(report, ui): response = ui.yesno("The contents of your /etc/sudoers file may help developers diagnose your bug more quickly, however, it may contain sensitive information. Do you want to include it in your bug report?") if response == None: #user cancelled raise StopIteration elif response == True: # This needs to be run as root report['Sudoers'] = root_command_output(['/bin/cat', '/etc/sudoers']) report['VisudoCheck'] = root_command_output(['/usr/sbin/visudo', '-c']) elif response == False: ui.information("The contents of your /etc/sudoers will NOT be included in the bug report.") PK ! ��<ׯ � package-hooks/libatasmart4.pynu �[��� '''apport package hook for libatasmart (c) 2009 Canonical Ltd. Author: Martin Pitt <martin.pitt@ubuntu.com> ''' import os import os.path import apport.hookutils import dbus UD = 'org.freedesktop.UDisks' def add_info(report): report['UdisksDump'] = apport.hookutils.command_output(['udisks', '--dump']) report['Udisks2Dump'] = apport.hookutils.command_output(['udisksctl', 'dump']) # grab SMART blobs dkd = dbus.Interface(dbus.SystemBus().get_object(UD, '/org/freedesktop/UDisks'), UD) for d in dkd.EnumerateDevices(): dev_props = dbus.Interface(dbus.SystemBus().get_object(UD, d), dbus.PROPERTIES_IFACE) blob = dev_props.Get(UD, 'DriveAtaSmartBlob') if len(blob) > 0: report['AtaSmartBlob_' + os.path.basename(d)] = ''.join(map(chr, blob)) if __name__ == '__main__': r = {} add_info(r) for k, v in r.items(): print('%s: "%s"' % (k, v)) PK ! "�� � ) package-hooks/ubuntu-desktop-installer.pynu �[��� """ Send reports about ubuntu-desktop-installer to the correct Launchpad project. """ import os from apport import hookutils def add_info(report, ui): udilog = os.path.realpath("/var/log/installer/ubuntu_desktop_installer.log") hookutils.attach_file_if_exists(report, udilog, "UdiLog") report['SourcePackage'] = 'ubuntu-desktop-installer' # rewrite this section so the report goes to the project in Launchpad report[ "CrashDB" ] = """{ "impl": "launchpad", "project": "ubuntu-desktop-installer", "bug_pattern_url": "http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml" }""" subiquitylog = os.path.realpath("/var/log/installer/subiquity-server-debug.log") hookutils.attach_file_if_exists(report, subiquitylog, "SubiquityLog") hookutils.attach_file_if_exists( report, "/var/log/installer/subiquity-curtin-install.conf", "CurtinConfig" ) hookutils.attach_file_if_exists( report, "/var/log/curtin/install.log", "CurtinLog" ) hookutils.attach_file_if_exists( report, "/var/log/curtin/curtin-error-logs.tar", "CurtinError" ) hookutils.attach_file_if_exists( report, "/var/log/installer/block/probe-data.json", "ProbeData" ) PK ! <xj: : package-hooks/cryptsetup.pynu �[��� '''apport package hook for cryptsetup (c) 2009 Author: Reinhard Tartler <siretart@tauware.de> (c) 2015 Author: Jonas Meurer <jonas@freesources.org> ''' from apport.hookutils import * msg = \ """ Providing additional information can help diagnose problems with cryptsetup. Specifically, this would include: - kernel cmdline (copy of /proc/cmdline). - crypttab configuration (copy of /etc/crypttab). - fstab configuration (copy of /etc/fstab). If this information is not relevant for your bug report or you have privacy concerns, please choose no. Do you want to provide additional information? (you will be able to review the data before it is sent) """ def add_info(report, ui): attach_files = False if ui: if ui.yesno(msg) == None: # user decided to cancel raise StopIteration # user is allowing files to be attached. attach_files = True if attach_files == False: # do not attach any files return attach_file(report, '/proc/cmdline', 'cmdline') attach_file(report, '/etc/fstab', 'fstab') attach_file_if_exists(report, '/etc/crypttab', 'crypttab') PK ! !�� � package-hooks/cloud-init.pynu �[��� """Wrapper for cloudinit apport interface""" from cloudinit.apport import add_info as cloudinit_add_info def add_info(report, ui): return cloudinit_add_info(report, ui) PK ! m���X X package-hooks/source_ubiquity.pynu �[��� '''Apport package hook for the ubiquity live CD installer. Copyright (C) 2009 Canonical Ltd. Authors: Colin Watson <cjwatson@ubuntu.com>, Brian Murray <brian@ubuntu.com>''' import apport.hookutils import os.path import re def add_installation_log(report, ident, name): f = False for try_location in ('/var/log/installer/%s', '/var/log/%s', '/var/log/upstart/%s'): if os.path.exists(try_location % name): f = try_location % name break if not f: return if os.access(f, os.R_OK): with open(f, 'rb') as f: report[ident] = f.read().decode('UTF-8', 'replace') elif os.path.exists(f): apport.hookutils.attach_root_command_outputs(report, {ident: "cat '%s'" % f}) if ident in report and isinstance(report[ident], bytes): try: report[ident] = report[ident].decode('UTF-8', 'replace') except (UnicodeDecodeError, KeyError): pass def prepare_duplicate_signature(syslog, collect_grub, collect_trace): collect = '' for line in syslog.split('\n'): if collect_grub: if 'grub-installer:' in line and collect == "": collect = ' '.join(line.split(' ')[4:]) + '\n' continue elif 'grub-installer:' in line and collect != "": collect += ' '.join(line.split(' ')[4:]) + '\n' continue if not collect_trace and collect != '': return collect if 'Traceback (most recent call last):' in line and \ collect_grub: collect += ' '.join(line.split(' ')[5:]) + '\n' continue if 'Traceback (most recent call last):' in line and \ not collect_grub: collect = ' '.join(line.split(' ')[5:]) + '\n' continue if len(line.split(' ')[5:]) == 1 and 'Traceback' in collect: if collect != '': return collect if 'Traceback' not in collect: continue collect += ' '.join(line.split(' ')[5:]) + '\n' def add_info(report, ui): add_installation_log(report, 'UbiquitySyslog', 'syslog') syslog = report['UbiquitySyslog'] if 'Buffer I/O error on device' in syslog: if re.search('Attached .* CD-ROM (\\w+)', syslog): cd_drive = re.search('Attached .* CD-ROM (\\w+)', syslog).group(1) cd_error = re.search('Buffer I/O error on device %s' % cd_drive, syslog) else: cd_error = None if cd_error: ui.information("The system log from your installation contains an error. The specific error commonly occurs when there is an issue with the media from which you were installing. This can happen when your media is dirty or damaged or when you've burned the media at a high speed. Please try cleaning the media and or burning new media at a lower speed. In the event that you continue to encounter these errors it may be an issue with your CD / DVD drive.") raise StopIteration if 'I/O error, dev' in syslog: # check for either usb stick (install media) or hard disk I/O errors if re.search('I/O error, dev (\\w+)', syslog): error_disk = re.search('I/O error, dev (\\w+)', syslog).group(1) mount = apport.hookutils.command_output(['grep', '%s' % error_disk, '/proc/mounts']) if 'target' in mount: ui.information("The system log from your installation contains an error. The specific error commonly occurs when there is an issue with the disk to which you are trying to install Ubuntu. It is recommended that you back up important data on your disk and investigate the situation. Measures you might take include checking cable connections for your disks and using software tools to investigate the health of your hardware.") raise StopIteration if 'cdrom' in mount: ui.information("The system log from your installation contains an error. The specific error commonly occurs when there is an issue with the media from which you were installing. Please try creating the USB stick you were installing from again or try installing from a different USB stick.") raise StopIteration if 'SQUASHFS error: Unable to read' in syslog: ui.information("The system log from your installation contains an error. The specific error commonly occurs when there is an issue with the media from which you were installing. This can happen when your media is dirty or damaged or when you've burned the media at a high speed. Please try cleaning the media and or burning new media at a lower speed. In the event that you continue to encounter these errors it may be an issue with your CD / DVD drive.") raise StopIteration if 'Kernel command line' in syslog: install_cmdline = re.search('Kernel command line: (.*)', syslog).group(1) else: install_cmdline = None if install_cmdline: report['InstallCmdLine'] = install_cmdline if 'Traceback' not in report: collect_grub = False collect_trace = False if 'grub-install ran successfully' not in syslog and 'grub-installer:' in syslog: collect_grub = True if 'Traceback' in syslog: collect_trace = True if report['ProblemType'] != 'Bug' and collect_grub or \ report['ProblemType'] != 'Bug' and collect_trace: duplicate_signature = prepare_duplicate_signature(syslog, collect_grub, collect_trace) if duplicate_signature: report['DuplicateSignature'] = duplicate_signature if collect_grub: report['SourcePackage'] = 'grub-installer' match = re.search('ubiquity.*Ubiquity (.*)\n', syslog) if match: match = match.group(1) report.setdefault('Tags', '') if match: report['Tags'] += ' ubiquity-%s' % match.split()[0] # tag bug reports where people choose to "upgrade" their install of Ubuntu if re.search('UpgradeSystem\\(\\) was called with safe mode', syslog): report['Tags'] += ' ubiquity-upgrade' add_installation_log(report, 'UbiquityPartman', 'partman') debug_log = '/var/log/installer/debug' debug_mode = False if os.path.exists(debug_log): try: fp = open(debug_log, 'r') except (OSError, IOError): pass else: with fp: for line in fp: if line.startswith('debconf (developer)'): debug_mode = True break if debug_mode: response = ui.yesno("The debug log file from your installation would help us a lot but includes the password you used for your user when installing Ubuntu. Do you want to include this log file?") if response is None: raise StopIteration if response: add_installation_log(report, 'UbiquityDebug', 'debug') else: add_installation_log(report, 'UbiquityDebug', 'debug') add_installation_log(report, 'UbiquityDm', 'dm') add_installation_log(report, 'UpstartUbiquity', 'ubiquity.log') # add seed name as Tag so we know which image was used with open('/proc/cmdline', 'r') as f: cmdline = f.read() match = re.search('([^/]+)\\.seed', cmdline) if match: report['Tags'] += ' ' + match.group(1) add_installation_log(report, 'Casper', 'casper.log') add_installation_log(report, 'OemConfigLog', 'oem-config.log') if 'OemConfigLog' in report: report['Tags'] += ' oem-config' PK ! ��P�g g package-hooks/systemd.pynu �[��� '''apport package hook for systemd (c) 2014 Canonical Ltd. Author: Martin Pitt <martin.pitt@ubuntu.com> ''' import os.path import apport.hookutils def add_info(report): apport.hookutils.attach_hardware(report) report['SystemdDelta'] = apport.hookutils.command_output(['systemd-delta']) if not os.path.exists('/run/systemd/system'): return # Add details about all failed units, if any out = apport.hookutils.command_output(['systemctl', '--state=failed', '--full', '--no-legend']).strip() if out: failed = '' for line in out.splitlines(): unit = line.split()[0] if failed: failed += '------\n' failed += apport.hookutils.command_output(['systemctl', 'status', '--full', unit]) report['SystemdFailedUnits'] = failed PK ! x�Ť| | / package-hooks/source_ubuntu-release-upgrader.pynu �[��� '''apport package hook for ubuntu-release-upgrader (c) 2011-2022 Canonical Ltd. Author: Brian Murray <brian@ubuntu.com> ''' import os import re from glob import glob from apport.hookutils import ( attach_gsettings_package, attach_file_if_exists, attach_root_command_outputs, command_output, root_command_output) def add_info(report, ui): try: attach_gsettings_package(report, 'ubuntu-release-upgrader') except: pass report['CrashDB'] = 'ubuntu' report.setdefault('Tags', 'dist-upgrade') report['Tags'] += ' dist-upgrade' clone_file = '/var/log/dist-upgrade/apt-clone_system_state.tar.gz' if os.path.exists(clone_file): report['VarLogDistupgradeAptclonesystemstate.tar.gz'] = \ root_command_output(["cat", clone_file], decode_utf8=False) attach_file_if_exists(report, '/var/log/dist-upgrade/apt.log', 'VarLogDistupgradeAptlog') attach_file_if_exists(report, '/var/log/dist-upgrade/apt-term.log', 'VarLogDistupgradeApttermlog') attach_file_if_exists(report, '/var/log/dist-upgrade/history.log', 'VarLogDistupgradeAptHistorylog') attach_file_if_exists(report, '/var/log/dist-upgrade/lspci.txt', 'VarLogDistupgradeLspcitxt') attach_file_if_exists(report, '/var/log/dist-upgrade/main.log', 'VarLogDistupgradeMainlog') attach_file_if_exists(report, '/var/log/dist-upgrade/term.log', 'VarLogDistupgradeTermlog') attach_file_if_exists(report, '/var/log/dist-upgrade/xorg_fixup.log', 'VarLogDistupgradeXorgFixuplog') attach_file_if_exists(report, '/var/log/dist-upgrade/screenlog.0', 'VarLogDistupgradeScreenlog') attach_root_command_outputs( report, {'CurrentDmesg.txt': 'dmesg | comm -13 --nocheck-order /var/log/dmesg -'}) if os.path.exists('/run/systemd/system'): report['JournalErrors'] = command_output( ['journalctl', '-b', '--priority=warning', '--lines=1000']) # the release upgrade may have crashed due to something else crashing reports = glob('/var/crash/*') if reports: report['CrashReports'] = command_output( ['stat', '-c', '%a:%u:%g:%s:%y:%x:%n'] + reports) problem_type = report.get("ProblemType", None) if problem_type == 'Crash': tmpdir = re.compile('ubuntu-release-upgrader-\w+') tb = report.get("Traceback", None) if tb: dupe_sig = '' for line in tb.splitlines(): scrub_line = tmpdir.sub('ubuntu-release-upgrader-tmpdir', line) dupe_sig += scrub_line + '\n' report["DuplicateSignature"] = dupe_sig PK ! Y� package-hooks/apache2.pynu �[��� #!/usr/bin/python '''apport hook for apache2 (c) 2010 Adam Sommer. Author: Adam Sommer <asommer@ubuntu.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from apport.hookutils import * import os SITES_ENABLED_DIR = '/etc/apache2/sites-enabled/' def add_info(report, ui): if os.path.isdir(SITES_ENABLED_DIR): response = ui.yesno("The contents of your " + SITES_ENABLED_DIR + " directory " "may help developers diagnose your bug more " "quickly. However, it may contain sensitive " "information. Do you want to include it in your " "bug report?") if response == None: # user cancelled raise StopIteration elif response == True: # Attache config files in /etc/apache2/sites-enabled and listing of files in /etc/apache2/conf.d for conf_file in os.listdir(SITES_ENABLED_DIR): attach_file_if_exists(report, SITES_ENABLED_DIR + conf_file, conf_file) try: report['Apache2ConfdDirListing'] = str(os.listdir('/etc/apache2/conf.d')) except OSError: report['Apache2ConfdDirListing'] = str(False) # Attach default config files if changed. attach_conffiles(report, 'apache2', conffiles=None) # Attach the error.log file. attach_file(report, '/var/log/apache2/error.log', key='error.log') # Get loaded modules. report['Apache2Modules'] = root_command_output(['/usr/sbin/apachectl', '-D DUMP_MODULES']) PK ! �x�� � package-hooks/openssh-server.pynu �[��� '''apport hook for openssh-server (c) 2010 Canonical Ltd. Author: Chuck Short <chuck.short@canonical.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from apport.hookutils import root_command_output def add_info(report, ui): response = ui.yesno("The contents of your /etc/ssh/sshd_config file " "may help developers diagnose your bug more " "quickly. However, it may contain sensitive " "information. Do you want to include it in your " "bug report?") if response == None: # user cancelled raise StopIteration elif response: report['SSHDConfig'] = root_command_output(['/usr/sbin/sshd', '-T']) PK ! �� package-hooks/isc-dhcp-client.pynu �[��� #!/usr/bin/python '''apport hook for dhclient (c) 2010 Canonical Ltd. Author: Chuck Short <chuck.short@canonical.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from apport.hookutils import * from os import path import re def dhcp_leases(pattern): ''' Extract options from '/var/lib/dhcp/dhclient.leases' which match a regex. pattern should be a "re" object. ''' lines = "" if os.path.exists('/var/lib/dhcp/dhclient.leases'): file = '/var/lib/dhcp/dhclient.leases' else: return lines for line in open(file): if pattern.search(line): lines += line return lines def add_info(report, ui): response = ui.yesno("The contents of your /etc/dhcp/dhclient.conf file may help developers diagnose your bug more quickly, however, it may contain sensitive information. Do you want to include it in your bug report?") if response == None: #user cancelled raise StopIteration elif response == True: attach_file_if_exists(report, '/etc/dhcp/dhclient.conf', 'Dhclient') attach_mac_events(report, ['/sbin/dhclient', '/usr/lib/NetworkManager/nm-dhcp-client.action', '/usr/lib/connman/scripts/dhclient-script']) attach_related_packages(report, ['apparmor', 'libapparmor1', 'libapparmor-perl', 'apparmor-utils', 'auditd', 'libaudit0']) attach_file(report, '/etc/apparmor.d/sbin.dhclient') leases = re.compile('option|renew|rebind|expire', re.IGNORECASE) report['DhclientLeases'] = dhcp_leases(leases) PK ! ���*v v % package-hooks/source_console-setup.pynu �[��� '''apport package hook for console-setup Copyright (C) 2009 Canonical Ltd. Author: Colin Watson <cjwatson@ubuntu.com> ''' import apport.hookutils def add_info(report): apport.hookutils.attach_file_if_exists( report, '/etc/default/keyboard', 'Keyboard') apport.hookutils.attach_file_if_exists( report, '/etc/default/console-setup', 'ConsoleSetup') PK ! __Dq9 9 package-hooks/source_apport.pynu �[��� '''Apport package hook for apport itself. This adds /var/log/apport.log and the file listing in /var/crash to the report. ''' # Copyright 2007 Canonical Ltd. # Author: Martin Pitt <martin.pitt@ubuntu.com> from glob import glob import apport.hookutils APPORT_LOG = '/var/log/apport.log' def add_info(report): apport.hookutils.attach_file_if_exists(report, APPORT_LOG, 'ApportLog') reports = glob('/var/crash/*') if reports: report['CrashReports'] = apport.hookutils.command_output( ['stat', '-c', '%a:%u:%g:%s:%y:%x:%n'] + reports) PK ! ��̃n n package-hooks/subiquity.pynu �[��� """Send reports about subiquity to the correct Launchpad project.""" import os import re from apport import Report, hookutils from apport.ui import HookUI def get_journal(report: Report, log_map: dict[str, str]) -> None: """Get installer environment journal log. Appends the installer specific journal to the log map if it exists, otherwise appends the system journal to the report directly. """ installer_journal = "/var/log/installer/installer-journal.txt" if os.path.exists(installer_journal): log_map["InstallerJournal"] = installer_journal else: report["SystemJournal"] = hookutils.recent_syslog(re.compile(".")) def get_revision(debug_log_contents: str) -> str: """Get subiquity revision from debug log contents. Returns revision found (e.g. "1234") or "unknown" if not found. """ # Revision information is always in the first line of the log file first_line = debug_log_contents.splitlines()[0] marker = "Starting Subiquity server revision" if marker in first_line: revision = first_line.split(marker)[1].strip() else: revision = "unknown" return revision def add_info(report: Report, unused_ui: HookUI) -> None: """Package hook entry point.""" # Check if the snap was updated # TODO: Add logic to support this outside of the live environment. # It may be possible someone wants to report a bug against the # installer after first boot. report["SnapUpdated"] = str(os.path.exists("/run/subiquity/updating")) # rewrite this section so the report goes to the project in Launchpad report[ "CrashDB" ] = """\ { "impl": "launchpad", "project": "subiquity", "bug_pattern_url": "http://people.canonical.com/" "~ubuntu-archive/bugpatterns/bugpatterns.xml", } """ # add in hardware information hookutils.attach_hardware(report) # This key is important for checking revision information later debug_log_key = "InstallerServerLog" # static subiquity generated logs log_map = { debug_log_key: "/var/log/installer/subiquity-server-debug.log", "InstallerServerLogInfo": "/var/log/installer/subiquity-server-info.log", "InstallerClientLog": "/var/log/installer/subiquity-client-debug.log", "InstallerClientLogInfo": "/var/log/installer/subiquity-client-info.log", "CurtinLog": "/var/log/installer/curtin-install.log", "CurtinAptConfig": "var/log/installer/curtin-install/subiquity-curtin-apt.conf", "CurtinCurthooksConfig": ( "/var/log/installer/curtin-install/subiquity-curthooks.conf" ), "CurtinExtractConfig": ( "/var/log/installer/curtin-install/subiquity-extract.conf" ), "CurtinInitialConfig": ( "/var/log/installer/curtin-install/subiquity-initial.conf" ), "CurtinPartitioningConfig": ( "/var/log/installer/curtin-install/subiquity-partitioning.conf" ), "ProbeData": "/var/log/installer/block/probe-data.json", "Traceback": "/var/log/installer/subiquity-traceback.txt", "NetplanInstallerConfig": "/etc/netplan/00-installer-config.yaml", "NetplanSnapdConfig": "/etc/netplan/00-snapd-config.yaml", } # Add journal log get_journal(report, log_map) # Add ubuntu-desktop-bootstrap information if available udb_log = os.path.realpath("/var/log/installer/ubuntu_bootstrap.log") if os.path.exists(udb_log): log_map["BootstrapLog"] = udb_log report.add_tags(["ubuntu-desktop-bootstrap"]) # check for udb snap version udb_snap = os.path.realpath("/snap/ubuntu-desktop-bootstrap/current") if os.path.exists(udb_snap): # "current" is a symlink to the current revision and # os.path.realpath should have resolved it report["DesktopInstallerRev"] = os.path.basename(udb_snap) # Attach logs if they exist # The conventional way to attach logs would be to use the # hookutils.attach_file_if_exists method, but since subiquity logs # are mostly locked down with root r/w only then we will get a permission # error if the caller does not have permissions. Ask for elevated # permissions instead of requiring users know to run with sudo or similar command_mapping = {} for name, path in log_map.items(): if os.path.exists(path): real_path = os.path.realpath(path) command_mapping[name] = f"cat {real_path}" hookutils.attach_root_command_outputs(report, command_mapping) # Get revision to display in the UI prompt # If attach_root_command_outputs fails the log won't be in the report revision = "unknown" if debug_log_key in report: revision = get_revision(report[debug_log_key]) report["Package"] = f"subiquity ({revision})" report["SourcePackage"] = "subiquity" # Package and SourcePackage keys are deleted when the Snap is chosen, # so make a separate key to keep track of the revision report["SnapVersion"] = revision # Always set reports to private since we might collect sensitive data report["LaunchpadPrivate"] = "1" PK ! �~U� � package-hooks/source_apparmor.pynu �[��� '''apport package hook for apparmor (c) 2009-2014 Canonical Ltd. Author: Steve Beattie <sbeattie@ubuntu.com> Jamie Strandboge <jamie@canonical.com> License: GPLv2 ''' from apport.hookutils import (attach_file, attach_file_if_exists, packaging, command_output, root_command_output) import os import re import codecs def stringify(s): '''Converts a byte array into a unicode string''' return codecs.latin_1_decode(s)[0] def recent_kernlog(pattern): '''Extract recent messages from kern.log or message which match a regex. pattern should be a "re" object. ''' lines = '' if os.path.exists('/var/log/kern.log'): file = '/var/log/kern.log' elif os.path.exists('/var/log/messages'): file = '/var/log/messages' else: return lines with open(file, 'rb') as f: for l in f.readlines(): line = stringify(l) if pattern.search(line): lines += line return lines def recent_syslog(pattern): '''Extract recent messages from syslog which match a regex. pattern should be a "re" object. ''' lines = '' if os.path.exists('/var/log/syslog'): file = '/var/log/syslog' else: return lines with open(file, 'rb') as f: for l in f.readlines(): line = stringify(l) if pattern.search(line): lines += line return lines def add_info(report, ui): attach_file(report, '/proc/version_signature', 'ProcVersionSignature') attach_file(report, '/proc/cmdline', 'ProcKernelCmdline') sec_re = re.compile('audit\(|apparmor|selinux|security', re.IGNORECASE) report['KernLog'] = recent_kernlog(sec_re) # DBus messages are reported to syslog dbus_sec_re = re.compile('dbus.* apparmor', re.IGNORECASE) report['Syslog'] = recent_syslog(dbus_sec_re) packages = ['apparmor', 'apparmor-utils', 'libapparmor1', 'libapparmor-dev', 'apparmor-utils', 'apparmor-profiles', 'python3-apparmor', 'libpam-apparmor', 'libapache2-mod-apparmor', 'python3-libapparmor', 'auditd', 'libaudit0'] versions = '' for package in packages: try: version = packaging.get_version(package) except ValueError: version = 'N/A' if version is None: version = 'N/A' versions += '%s %s\n' % (package, version) report['ApparmorPackages'] = versions # These need to be run as root report['ApparmorStatusOutput'] = root_command_output(['/usr/sbin/apparmor_status']) report['PstreeP'] = command_output(['/usr/bin/pstree', '-p']) attach_file_if_exists(report, '/var/log/audit/audit.log', 'audit.log') PK ! ?�� � . package-hooks/source_ubuntu-advantage-tools.pynu �[��� import os import tempfile from apport.hookutils import attach_file_if_exists from uaclient import defaults from uaclient.actions import collect_logs, APPARMOR_PROFILES from uaclient.config import UAConfig def add_info(report, ui=None): report["LaunchpadPrivate"] = "1" report["LaunchpadSubscribe"] = "ua-client" cfg = UAConfig() apparmor_files = [os.path.basename(f) for f in APPARMOR_PROFILES] with tempfile.TemporaryDirectory() as output_dir: collect_logs(cfg, output_dir) auto_include_log_files = { "cloud-id.txt", "cloud-id.txt-error", "ua-status.json", "ua-status.json-error", "livepatch-status.txt", "livepatch-status.txt-error", "pro-journal.txt", "apparmor_logs.txt", *apparmor_files, os.path.basename(cfg.cfg_path), os.path.basename(cfg.log_file), os.path.basename(cfg.data_path("jobs-status")), os.path.basename(defaults.CONFIG_DEFAULTS["log_file"]), } for f in auto_include_log_files: attach_file_if_exists(report, os.path.join(output_dir, f), key=f) PK ! p -7r r ( package-hooks/source_debian-installer.pynu �[��� '''Apport package hook for the Debian installer. Copyright (C) 2011 Canonical Ltd. Authors: Colin Watson <cjwatson@ubuntu.com>, Brian Murray <brian@ubuntu.com>''' import os from apport.hookutils import attach_hardware, command_available, command_output, attach_root_command_outputs def add_installation_log(report, ident, name): if os.path.exists('/var/log/installer/%s' % name): f = '/var/log/installer/%s' % name elif os.path.exists('/var/log/%s' % name): f = '/var/log/%s' % name else: return if os.access(f, os.R_OK): report[ident] = (f,) else: attach_root_command_outputs(report, {ident: "cat '%s'" % f}) def add_info(report): attach_hardware(report) report['DiskUsage'] = command_output(['df']) report['MemoryUsage'] = command_output(['free']) if command_available('dmraid'): attach_root_command_outputs(report, {'DmraidSets': 'dmraid -s', 'DmraidDevices': 'dmraid -r'}) if command_available('dmsetup'): attach_root_command_outputs(report, {'DeviceMapperTables': 'dmsetup table'}) try: installer_version = open('/var/log/installer/version') for line in installer_version: if line.startswith('ubiquity '): # File these reports on the ubiquity package instead report['SourcePackage'] = 'ubiquity' break installer_version.close() except IOError: pass add_installation_log(report, 'DIPartman', 'partman') add_installation_log(report, 'DISyslog', 'syslog') if __name__ == '__main__': report = {} add_info(report) for key in report: if isinstance(report[key], type('')): print('%s: %s' % (key, report[key].split('\n', 1)[0])) else: print('%s: %s' % (key, type(report[key]))) PK ! ���� � package-hooks/source_mdadm.pynu �[��� '''apport package hook for mdadm (c) 2009-2016 Canonical Ltd. Author: Steve Beattie <sbeattie@ubuntu.com> Based on the ideas in debian's /usr/share/bug/mdadm/script ''' from apport.hookutils import attach_file, attach_file_if_exists, attach_hardware, path_to_key, command_output import os import re import glob import gzip import subprocess import sys def get_initrd_files(pattern): '''Extract listing of files from the current initrd which match a regex. pattern should be a "re" object. ''' (_, _, release, _, _) = os.uname() try: fd = gzip.GzipFile('/boot/initrd.img-' + release, 'rb') # universal_newlines needs to be False here as we're passing # binary data from gzip into cpio, which means we'll need to # decode the bytes into strings later when reading the output cpio = subprocess.Popen(['cpio', '-t'], close_fds=True, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=False) except OSError as e: return 'Error: ' + str(e) out = cpio.communicate(fd.read())[0].decode(sys.stdout.encoding, errors='replace') if cpio.returncode != 0: return 'Error: command %s failed with exit code %i %' % ( 'cpio', cpio.returncode, out) lines = ''.join([l for l in out.splitlines(True) if pattern.search(l)]) return lines def add_info(report): attach_hardware(report) attach_file(report, '/proc/mounts', 'ProcMounts') attach_file_if_exists(report, '/etc/mdadm/mdadm.conf', 'mdadm.conf') attach_file(report, '/proc/mdstat', 'ProcMDstat') attach_file(report, '/proc/partitions', 'ProcPartitions') attach_file(report, '/etc/blkid.tab', 'etc.blkid.tab') attach_file_if_exists(report, '/boot/grub/menu.lst', 'GrubMenu.lst') attach_file_if_exists(report, '/boot/grub/grub.cfg', 'Grub.cfg') attach_file_if_exists(report, '/etc/lilo.conf', 'lilo.conf') devices = glob.glob("/dev/[hs]d*") for dev in devices: report['MDadmExamine' + path_to_key(dev)] = command_output(['/sbin/mdadm', '-E', dev]) initrd_re = re.compile('md[a/]') report['initrd.files'] = get_initrd_files(initrd_re) PK ! � Z$� � package-hooks/source_plymouth.pynu �[��� '''apport package hook for plymouth Copyright 2010 Canonical Ltd. Authors: Steve Langasek <steve.langasek@ubuntu.com>, Brian Murray <brian@ubuntu.com> ''' from apport.hookutils import * import os.path def _attach_file_filtered(report, path, key=None): '''filter out password from grub configuration''' if not key: key = path_to_key(path) if os.path.exists(path): with open(path,'r') as f: filtered = [l if not l.startswith('password') else '### PASSWORD LINE REMOVED ###' for l in f.readlines()] report[key] = ''.join(filtered) def add_info(report): attach_hardware(report) attach_file(report, '/proc/fb', 'ProcFB') attach_file(report, '/proc/cmdline', 'ProcCmdLine') attach_file(report, '/var/log/boot.log', 'BootLog') debug_log = '/var/log/plymouth-debug.log' if os.path.exists(debug_log): attach_root_command_outputs(report, {'PlymouthDebug': 'cat %s' % debug_log}) _attach_file_filtered(report, '/etc/default/grub', 'EtcDefaultGrub') default_alternative = '/etc/alternatives/default.plymouth' if os.path.exists(default_alternative): report['DefaultPlymouth'] = command_output(['readlink', default_alternative]) text_alternative = '/etc/alternatives/text.plymouth' if os.path.exists(text_alternative): report['TextPlymouth'] = command_output(['readlink', text_alternative]) PK ! �UxH' ' package-hooks/source_grub2.pynu �[��� # vim: set fileencoding=UTF-8 : '''apport package hook for grub2 Author: Jean-Baptiste Lallement <jeanbaptiste.lallement@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. See http://www.gnu.org/copyleft/gpl.html for the full text of the license. ''' from __future__ import print_function import os import re import subprocess from apport.hookutils import ( attach_default_grub, attach_file, attach_file_if_exists, path_to_key, ) def check_shell_syntax(path): ''' Check the syntax of a shell script ''' try: with open(os.devnull, 'w') as devnull: subprocess.check_call(['/bin/sh', '-n', path], stderr=devnull) except subprocess.CalledProcessError: return False return True def check_shell_syntax_harder(path): ''' Check the syntax of a shell script ''' try: # sh -n is tempting, but not good enough. Consider this case: # # GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash nomodeset” # # The quotes are Unicode quotes, not valid in the shell and probably # caused by copying a line out of a web page. This is parsed as an # instruction to run the 'splash' command with argument 'nomodeset”' # and with the GRUB_CMDLINE_LINUX_DEFAULT environment variable set # to '”quiet'. 'sh -n' allows this because this is a valid parse # and it's possible that the command 'splash' might exist, but what # we need to know is whether sourcing the file will fail. # # Unfortunately this test may involve executing code. However, this # file is already sourced as root when running update-grub, so it # seems unlikely that this could do any further harm. with open(os.devnull, 'w') as devnull: subprocess.check_call( ['/bin/sh', '-ec', '. %s' % re.escape(path)], stderr=devnull) except subprocess.CalledProcessError: return False return True def add_info(report): if report['ProblemType'] == 'Package': # To detect if root fs is a loop device attach_file(report, '/proc/cmdline', 'ProcCmdLine') attach_default_grub(report, 'EtcDefaultGrub') attach_file_if_exists(report, '/boot/grub/device.map', 'DeviceMap') try: grub_d = '/etc/default/grub.d' for name in sorted(os.listdir(grub_d)): if name.endswith('.cfg'): key = 'EtcDefaultGrubD.' + path_to_key(name) attach_file_if_exists( report, os.path.join(grub_d, name), key) except OSError: pass invalid_grub_script = [] if not check_shell_syntax_harder('/etc/default/grub'): invalid_grub_script.append('/etc/default/grub') # Check scripts in /etc/grub.d since some users directly change # configuration there grubdir = '/etc/grub.d' for f in os.listdir(grubdir): fullpath = os.path.join(grubdir, f) if f != 'README' and os.access(fullpath, os.X_OK) \ and not check_shell_syntax(fullpath): invalid_grub_script.append(fullpath) attach_file(report, fullpath) # TODO: Add some UI to ask if the user modified the invalid script # and if he still wants to report it if invalid_grub_script: report['InvalidGrubScript'] = ' '.join(invalid_grub_script) if __name__ == '__main__': r = {} r['ProblemType'] = 'Package' add_info(r) for k, v in r.items(): print('%s: "%s"' % (k, v)) print("========================================") PK ! �i1�� � &