Merge lp:~juliank/ubuntu/bionic/apport/snap into lp:~ubuntu-core-dev/ubuntu/bionic/apport/ubuntu

Proposed by Julian Andres Klode
Status: Merged
Merged at revision: 2621
Proposed branch: lp:~juliank/ubuntu/bionic/apport/snap
Merge into: lp:~ubuntu-core-dev/ubuntu/bionic/apport/ubuntu
Diff against target: 115 lines (+50/-2) (has conflicts)
3 files modified
apport/ui.py (+40/-2)
debian/changelog (+9/-0)
debian/control (+1/-0)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~juliank/ubuntu/bionic/apport/snap
Reviewer Review Type Date Requested Status
Brian Murray Approve
Steve Langasek Needs Fixing
Review via email: mp+342207@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) :
review: Needs Fixing
Revision history for this message
Julian Andres Klode (juliank) :
2620. By Julian Andres Klode

Change "The report belongs to a" to "This report is about a"

2621. By Julian Andres Klode

Tweak forum.snapcraft.io message

2622. By Julian Andres Klode

Clarify situation where both deb and snap are installed

Revision history for this message
Steve Langasek (vorlon) wrote :

looks good, a few small language tweaks only.

review: Needs Fixing
Revision history for this message
Brian Murray (brian-murray) wrote :

I think there a couple of instances where we will know whether or not the report should be about the deb package. In the event that information is being collected about a crash then ExecutablePath will be set and we can check if that is from a snap or a deb package. Additionally, it is possible to use the command ubuntu-bug about a program path. In that case we'd also know whether the program path was from a deb package or a snap. That being said I couldn't easily tell if that information was passed on to ui.py.

review: Needs Fixing
Revision history for this message
Julian Andres Klode (juliank) wrote :

I think the use case we are looking at is apport-bug <package name>, so we can just restrict snap handling to that. (if we crashed in a snap we won't have a cur_package, so we don't even reach that point).

2623. By Julian Andres Klode

Restrict snap handling to apport-bug <package name>

2624. By Julian Andres Klode

Wording improvements: .deb => deb, "," to "."

Revision history for this message
Brian Murray (brian-murray) wrote :

This looks good to me now although we should open a bug about

 809 # executable?
 810 elif '/' in self.args[0]:
 811 pkg = apport.packaging.get_file_package(self.args[0])
 812 if not pkg:
 813 optparser.error('%s does not belong to a package.' % self.args[0])
 814 sys.exit(1)

not working with snaps.

review: Approve
Revision history for this message
Brian Murray (brian-murray) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'apport/ui.py'
2--- apport/ui.py 2018-02-14 18:17:53 +0000
3+++ apport/ui.py 2018-03-29 09:18:49 +0000
4@@ -66,6 +66,19 @@
5 return True
6
7
8+def find_snap(package):
9+ import requests_unixsocket
10+
11+ session = requests_unixsocket.Session()
12+ try:
13+ r = session.get('http+unix://%2Frun%2Fsnapd.socket/v2/snaps/{}'.format(package))
14+ if r.status_code == 200:
15+ j = r.json()
16+ return j["result"]
17+ except Exception:
18+ return None
19+
20+
21 def thread_collect_info(report, reportfile, package, ui, symptom_script=None,
22 ignore_uninstalled=False):
23 '''Collect information about report.
24@@ -190,6 +203,7 @@
25 self.report_file = None
26 self.cur_package = None
27 self.offer_restart = False
28+ self.specified_a_pkg = False
29
30 try:
31 self.crashdb = apport.crashdb.get_crashdb(None)
32@@ -819,6 +833,7 @@
33 # otherwise: package name
34 else:
35 self.options.filebug = True
36+ self.specified_a_pkg = True
37 self.options.package = self.args[0]
38 self.args = []
39
40@@ -1054,14 +1069,37 @@
41 repr(e))
42 self.report['_MarkForUpload'] = 'False'
43 except ValueError: # package does not exist
44- self.report['UnreportableReason'] = _('The report belongs to a package that is not installed.')
45- self.report['_MarkForUpload'] = 'False'
46+ snap = find_snap(self.cur_package)
47+ if not snap:
48+ pass
49+ elif snap.get("contact", ""):
50+ self.report['UnreportableReason'] = _('This report is about a snap published by %s. Contact them via %s for help.') % (snap["developer"], snap["contact"])
51+ self.report['_MarkForUpload'] = 'False'
52+ else:
53+ self.report['UnreportableReason'] = _('This report is about a snap published by %s. No contact address has been provided; visit the forum at https://forum.snapcraft.io/ for help.') % snap["developer"]
54+ self.report['_MarkForUpload'] = 'False'
55+
56+ if 'UnreportableReason' not in self.report:
57+ self.report['UnreportableReason'] = _('This report is about a package that is not installed.')
58+ self.report['_MarkForUpload'] = 'False'
59 except Exception as e:
60 apport.error(repr(e))
61 self.report['UnreportableReason'] = _('An error occurred while attempting to '
62 'process this problem report:') + '\n\n' + str(e)
63 self.report['_MarkForUpload'] = 'False'
64
65+ snap = find_snap(self.cur_package)
66+ if snap and 'UnreportableReason' not in self.report and self.specified_a_pkg:
67+ if snap.get("contact", ""):
68+ msg = _('You are about to report a bug against the deb package, but you also a have snap published by %s installed. You can contact them via %s for help. Do you want to continue with the bug report against the deb?') % (snap["developer"], snap["contact"])
69+ else:
70+ msg = _('You are about to report a bug against the deb package, but you also a have snap published by %s installed. For the snap, no contact address has been provided; visit the forum at https://forum.snapcraft.io/ for help. Do you want to continue with the bug report against the deb?') % snap["developer"]
71+
72+ if not self.ui_question_yesno(msg):
73+ self.ui_stop_info_collection_progress()
74+ sys.exit(0)
75+ return
76+
77 if 'UnreportableReason' in self.report or not self.check_report_crashdb():
78 self.ui_stop_info_collection_progress()
79 if on_finished:
80
81=== modified file 'debian/changelog'
82--- debian/changelog 2018-03-28 18:45:34 +0000
83+++ debian/changelog 2018-03-29 09:18:49 +0000
84@@ -1,3 +1,4 @@
85+<<<<<<< TREE
86 apport (2.20.9-0ubuntu2) bionic; urgency=medium
87
88 * data/general-hooks/generic.py: Have JournalErrors include warnings but
89@@ -6,6 +7,14 @@
90
91 -- Brian Murray <brian@ubuntu.com> Wed, 28 Mar 2018 11:45:29 -0700
92
93+=======
94+apport (2.20.9-0ubuntu2) UNRELEASED; urgency=medium
95+
96+ * Help people who are trying to report bugs against snaps (LP: #1729491)
97+
98+ -- Julian Andres Klode <juliank@ubuntu.com> Tue, 27 Mar 2018 16:08:34 +0200
99+
100+>>>>>>> MERGE-SOURCE
101 apport (2.20.9-0ubuntu1) bionic; urgency=medium
102
103 * New upstream release:
104
105=== modified file 'debian/control'
106--- debian/control 2017-12-13 18:30:20 +0000
107+++ debian/control 2018-03-29 09:18:49 +0000
108@@ -114,6 +114,7 @@
109 python3-apt (>= 0.7.9),
110 python3-httplib2,
111 python3-problem-report (>= 0.94),
112+ python3-requests-unixsocket,
113 lsb-release,
114 ${misc:Depends}
115 Recommends: apport

Subscribers

People subscribed via source and target branches