Merge lp:~er-abhinav-upadhyay/ubuntu/natty/apport/bugfix-357847 into lp:~ubuntu-core-dev/ubuntu/natty/apport/ubuntu

Proposed by Abhinav Upadhyay
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~er-abhinav-upadhyay/ubuntu/natty/apport/bugfix-357847
Merge into: lp:~ubuntu-core-dev/ubuntu/natty/apport/ubuntu
Diff against target: 182 lines (+48/-17)
2 files modified
apport/ui.py (+40/-17)
debian/changelog (+8/-0)
To merge this branch: bzr merge lp:~er-abhinav-upadhyay/ubuntu/natty/apport/bugfix-357847
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Daniel Holbach Pending
Dustin Kirkland  Pending
Review via email: mp+53184@code.launchpad.net

Description of the change

I have added support for -w/--window option which will enable user to point to the problematic window and generate a crash report for that application.

I used Matt Zimmerman's implementation of the idea, as it was being discussed on the bug report page.

To post a comment you must log in.
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Per feedback from pitti in IRC, he would rather review this one himself. I'm stepping aside now.

Revision history for this message
Martin Pitt (pitti) wrote :

Note that the shell wrapper isn't supposed to do any option processing. Support for this should be added to apport/ui.py instead (where it can also be covered by test cases, at least the ones which check CLI processing).

review: Needs Fixing
Revision history for this message
Abhinav Upadhyay (er-abhinav-upadhyay) wrote :

> Note that the shell wrapper isn't supposed to do any option processing.
> Support for this should be added to apport/ui.py instead (where it can also be
> covered by test cases, at least the ones which check CLI processing).

Ok. Thanks for reviewing it :-)

I will try to implement this in apport/ui.py . I was wondering if -x option is ok ? I chose -x because it invokes xprop.

Revision history for this message
Martin Pitt (pitti) wrote :

Hello Abhinav,

Abhinav Upadhyay [2011-03-14 17:33 -0000]:
> I will try to implement this in apport/ui.py . I was wondering if -x
> option is ok ? I chose -x because it invokes xprop.

It shouldn't be named after the implementation, but after the
functionality. What do you think about -w/--window?

Thanks!

Martin

--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

1760. By Abhinav Upadhyay

apport/ui.py: Modified to add support for -w/--window option which will let the user
point and click at the buggy window, to generate the crash report for that application.

1761. By Abhinav Upadhyay

apport/ui.py: Added support for -w/--window option which will enable user to select the buggy window.
Also updated the debian changelog

Revision history for this message
Martin Pitt (pitti) wrote :

Hey Abhinav,

thanks for your work on that!

Unfortunately you created a MP against the Ubuntu packaging branch instead of trunk, so I cannot formally merge this. I applied the patch to trunk:

  http://bazaar.launchpad.net/~apport-hackers/apport/trunk/revision/1872

I also cleaned it up a little bit, fixed the tests to succeed, avoid using the shell, fix i18n, etc.

review: Approve

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 2011-02-28 11:07:58 +0000
3+++ apport/ui.py 2011-03-17 12:19:31 +0000
4@@ -585,6 +585,15 @@
5 except OSError as e:
6 self.ui_error_message(_('Invalid problem report'), excstr(e))
7 return True
8+ elif self.options.get_window_pid == True:
9+ self.ui_info_message('Apport --Window', 'After closing this message '\
10+ 'box please point and click on the buggy window to report the problem')
11+ pid = subprocess.Popen(['xprop _NET_WM_PID | cut -d= -f2'], \
12+ shell = True, stdout = subprocess.PIPE).communicate()[0]
13+ pid = int(pid.decode('UTF-8').strip())
14+ self.options.pid = pid
15+ self.options.get_window_pid = False
16+ return self.run_report_bug()
17 else:
18 return self.run_crashes()
19
20@@ -651,6 +660,8 @@
21 help=_('Add an extra tag to the report. Can be specified multiple times.'))
22 optparser.add_option('-v', '--version', action='store_true',
23 help=_('Print the Apport version number.'))
24+ optparser.add_option('-w', '--window', action='store_true', dest='get_window_pid', default=False,
25+ help=_('Point the mouse pointer at the buggy window and file a bug report'))
26
27 if len(sys.argv) > 0 and cmd.endswith('-bug'):
28 for o in ('-f', '-u', '-s', '-p', '-P', '-c'):
29@@ -2679,14 +2690,16 @@
30 # no arguments -> show pending crashes
31 _chk('apport-gtk', None, {'filebug': False, 'package': None,
32 'pid': None, 'crash_file': None, 'symptom': None,
33- 'update_report': None, 'save': None, 'tag': []})
34+ 'update_report': None, 'save': None, 'get_window_pid': False,
35+ 'tag': []})
36 # updating report not allowed without args
37 self.assertRaises(SystemExit, _chk, 'apport-collect', None, {})
38
39 # package
40 _chk('apport-kde', 'coreutils', {'filebug': True, 'package':
41 'coreutils', 'pid': None, 'crash_file': None, 'symptom': None,
42- 'update_report': None, 'save': None, 'tag': []})
43+ 'update_report': None, 'save': None, 'get_window_pid': False,
44+ 'tag': []})
45
46 # symptom is preferred over package
47 f = open(os.path.join(symptom_script_dir, 'coreutils.py'), 'w')
48@@ -2697,33 +2710,37 @@
49 f.close()
50 _chk('apport-cli', 'coreutils', {'filebug': True, 'package': None,
51 'pid': None, 'crash_file': None, 'symptom': 'coreutils',
52- 'update_report': None, 'save': None, 'tag': []})
53+ 'update_report': None, 'save': None, 'get_window_pid': False,
54+ 'tag': []})
55
56 # PID
57 _chk('apport-cli', '1234', {'filebug': True, 'package': None,
58 'pid': '1234', 'crash_file': None, 'symptom': None,
59- 'update_report': None, 'save': None, 'tag': []})
60+ 'update_report': None, 'save': None, 'get_window_pid': False,
61+ 'tag': []})
62
63 # .crash/.apport files; check correct handling of spaces
64 for suffix in ('.crash', '.apport'):
65 _chk('apport-cli', '/tmp/f oo' + suffix, {'filebug': False,
66 'package': None, 'pid': None,
67 'crash_file': '/tmp/f oo' + suffix, 'symptom': None,
68- 'update_report': None, 'save': None, 'tag': []})
69+ 'update_report': None, 'save': None, 'get_window_pid': False,
70+ 'tag': []})
71
72 # executable
73 _chk('apport-cli', '/usr/bin/tail', {'filebug': True,
74 'package': 'coreutils',
75 'pid': None, 'crash_file': None, 'symptom': None,
76- 'update_report': None, 'save': None, 'tag': []})
77+ 'update_report': None, 'save': None, 'get_window_pid': False,
78+ 'tag': []})
79
80 # update existing report
81 _chk('apport-collect', '1234', {'filebug': False, 'package': None,
82 'crash_file': None, 'symptom': None, 'update_report': 1234,
83- 'tag': []})
84+ 'get_window_pid': False,'tag': []})
85 _chk('apport-update-bug', '1234', {'filebug': False, 'package': None,
86 'crash_file': None, 'symptom': None, 'update_report': 1234,
87- 'tag': []})
88+ 'get_window_pid': False, 'tag': []})
89
90 def test_parse_argv_apport_bug(self):
91 '''parse_args() option inference when invoked as *-bug'''
92@@ -2746,7 +2763,8 @@
93 #
94 _chk([], {'filebug': True, 'package': None,
95 'pid': None, 'crash_file': None, 'symptom': None,
96- 'update_report': None, 'save': None, 'tag': []})
97+ 'update_report': None, 'save': None, 'get_window_pid': None,
98+ 'get_window_pid': False, 'tag': []})
99
100 #
101 # single arguments
102@@ -2755,7 +2773,8 @@
103 # package
104 _chk(['coreutils'], {'filebug': True, 'package':
105 'coreutils', 'pid': None, 'crash_file': None, 'symptom': None,
106- 'update_report': None, 'save': None, 'tag': []})
107+ 'update_report': None, 'save': None, 'get_window_pid': None,
108+ 'get_window_pid': False, 'tag': []})
109
110 # symptom (preferred over package)
111 f = open(os.path.join(symptom_script_dir, 'coreutils.py'), 'w')
112@@ -2766,25 +2785,29 @@
113 f.close()
114 _chk(['coreutils'], {'filebug': True, 'package': None,
115 'pid': None, 'crash_file': None, 'symptom': 'coreutils',
116- 'update_report': None, 'save': None, 'tag': []})
117+ 'update_report': None, 'save': None, 'get_window_pid': False,
118+ 'tag': []})
119 os.unlink(os.path.join(symptom_script_dir, 'coreutils.py'))
120
121 # PID
122 _chk(['1234'], {'filebug': True, 'package': None,
123 'pid': '1234', 'crash_file': None, 'symptom': None,
124- 'update_report': None, 'save': None, 'tag': []})
125+ 'update_report': None, 'save': None, 'get_window_pid': False,
126+ 'tag': []})
127
128 # .crash/.apport files; check correct handling of spaces
129 for suffix in ('.crash', '.apport'):
130 _chk(['/tmp/f oo' + suffix], {'filebug': False,
131 'package': None, 'pid': None,
132 'crash_file': '/tmp/f oo' + suffix, 'symptom': None,
133- 'update_report': None, 'save': None, 'tag': []})
134+ 'update_report': None, 'save': None, 'get_window_pid': False,
135+ 'tag': []})
136
137 # executable name
138 _chk(['/usr/bin/tail'], {'filebug': True, 'package': 'coreutils',
139 'pid': None, 'crash_file': None, 'symptom': None,
140- 'update_report': None, 'save': None, 'tag': []})
141+ 'update_report': None, 'save': None, 'get_window_pid': False,
142+ 'tag': []})
143
144 #
145 # supported options
146@@ -2794,17 +2817,17 @@
147 _chk(['--save', 'foo.apport', 'coreutils'], {'filebug': True,
148 'package': 'coreutils', 'pid': None, 'crash_file': None,
149 'symptom': None, 'update_report': None, 'save': 'foo.apport',
150- 'tag': []})
151+ 'get_window_pid': False, 'tag': []})
152
153 # --tag
154 _chk(['--tag', 'foo', 'coreutils'], {'filebug': True,
155 'package': 'coreutils', 'pid': None, 'crash_file': None,
156 'symptom': None, 'update_report': None, 'save': None,
157- 'tag': ['foo']})
158+ 'get_window_pid': False, 'tag': ['foo']})
159 _chk(['--tag', 'foo', '--tag', 'bar', 'coreutils'], {
160 'filebug': True, 'package': 'coreutils', 'pid': None,
161 'crash_file': None, 'symptom': None, 'update_report': None,
162- 'save': None, 'tag': ['foo', 'bar']})
163+ 'save': None, 'get_window_pid': False, 'tag': ['foo', 'bar']})
164
165 unittest.main()
166
167
168=== modified file 'debian/changelog'
169--- debian/changelog 2011-03-09 18:21:26 +0000
170+++ debian/changelog 2011-03-17 12:19:31 +0000
171@@ -1,3 +1,11 @@
172+apport (1.19-0ubuntu4) natty; urgency=low
173+
174+ * apport/ui.py: Added support for -w/--window option which will enable user to select the
175+ problematic window and generate a crash report.
176+ (LP: #357847)
177+
178+ -- Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> Thu, 17 Mar 2011 17:42:16 +0530
179+
180 apport (1.19-0ubuntu3) natty; urgency=low
181
182 * Merge fixes from trunk:

Subscribers

People subscribed via source and target branches