Public bug reported: I was reviewing an apport hook for somebody and noticed that apport-cli would crash when you try to save a report (option K) if the apport hook does something odd. As an example:
1) mkdir -p /tmp/directory1/directory2 2) modify an apport package hook to contain the following: contents = os.listdir('/tmp/directory1') report['DirContents'] = contents 3) run apport-cli ubuntu-release-upgrader (package hook I modified) 4) observe the following crash Traceback (most recent call last): File "/usr/bin/apport-cli", line 370, in <module> if not app.run_argv(): File "/usr/lib/python3/dist-packages/apport/ui.py", line 645, in run_argv self.run_symptom() File "/usr/lib/python3/dist-packages/apport/ui.py", line 636, in run_symptom self.run_report_bug(script) File "/usr/lib/python3/dist-packages/apport/ui.py", line 489, in run_report_bug response = self.ui_present_report_details(allowed_to_report) File "/usr/bin/apport-cli", line 220, in ui_present_report_details self.report.write(f) File "/usr/lib/python3/dist-packages/problem_report.py", line 448, in write f = open(v[0], 'rb') # file name FileNotFoundError: [Errno 2] No such file or directory: 'directory2' If DirContents is a folder that contains at least one file we see the following error raised instead. TypeError: value for key DirContents must be a string, CompressedValue, or a file reference ** Affects: apport (Ubuntu) Importance: Medium Status: New ** Tags: xenial ** Tags added: xenial ** Changed in: apport (Ubuntu) Importance: Undecided => Medium -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to apport in Ubuntu. https://bugs.launchpad.net/bugs/1596713 Title: apport-cli crashes if a hook provides a python list which is a directory w/o files Status in apport package in Ubuntu: New Bug description: I was reviewing an apport hook for somebody and noticed that apport- cli would crash when you try to save a report (option K) if the apport hook does something odd. As an example: 1) mkdir -p /tmp/directory1/directory2 2) modify an apport package hook to contain the following: contents = os.listdir('/tmp/directory1') report['DirContents'] = contents 3) run apport-cli ubuntu-release-upgrader (package hook I modified) 4) observe the following crash Traceback (most recent call last): File "/usr/bin/apport-cli", line 370, in <module> if not app.run_argv(): File "/usr/lib/python3/dist-packages/apport/ui.py", line 645, in run_argv self.run_symptom() File "/usr/lib/python3/dist-packages/apport/ui.py", line 636, in run_symptom self.run_report_bug(script) File "/usr/lib/python3/dist-packages/apport/ui.py", line 489, in run_report_bug response = self.ui_present_report_details(allowed_to_report) File "/usr/bin/apport-cli", line 220, in ui_present_report_details self.report.write(f) File "/usr/lib/python3/dist-packages/problem_report.py", line 448, in write f = open(v[0], 'rb') # file name FileNotFoundError: [Errno 2] No such file or directory: 'directory2' If DirContents is a folder that contains at least one file we see the following error raised instead. TypeError: value for key DirContents must be a string, CompressedValue, or a file reference To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1596713/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp