Merge lp:~brian-murray/ubuntu/disco/apport/usrmerge-changes into lp:~ubuntu-core-dev/ubuntu/disco/apport/ubuntu

Proposed by Brian Murray
Status: Merged
Merged at revision: 2662
Proposed branch: lp:~brian-murray/ubuntu/disco/apport/usrmerge-changes
Merge into: lp:~ubuntu-core-dev/ubuntu/disco/apport/ubuntu
Diff against target: 128 lines (+19/-12)
3 files modified
apport/report.py (+1/-1)
backends/packaging-apt-dpkg.py (+7/-0)
test/test_report.py (+11/-11)
To merge this branch: bzr merge lp:~brian-murray/ubuntu/disco/apport/usrmerge-changes
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+361208@code.launchpad.net

Description of the change

I disable the /etc/passwd test because I wasn't really sure what it did and the ExecutablePath part was not passing any more. If you have an idea let me know!

To post a comment you must log in.
2663. By Brian Murray

reorder bindirs so /usr stuff comes first and modify interpreter_path test appropriately

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'apport/report.py'
--- apport/report.py 2018-05-09 23:30:27 +0000
+++ apport/report.py 2018-12-20 23:42:02 +0000
@@ -417,7 +417,7 @@
417 return417 return
418418
419 cmdargs = self['ProcCmdline'].split('\0')419 cmdargs = self['ProcCmdline'].split('\0')
420 bindirs = ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/']420 bindirs = ['/usr/bin/', '/usr/sbin/', '/bin/', '/sbin/']
421421
422 # filter out interpreter options422 # filter out interpreter options
423 while len(cmdargs) >= 2 and cmdargs[1].startswith('-'):423 while len(cmdargs) >= 2 and cmdargs[1].startswith('-'):
424424
=== modified file 'backends/packaging-apt-dpkg.py'
--- backends/packaging-apt-dpkg.py 2018-12-20 17:45:47 +0000
+++ backends/packaging-apt-dpkg.py 2018-12-20 23:42:02 +0000
@@ -481,6 +481,13 @@
481 match = self.__fgrep_files(file, likely_lists)481 match = self.__fgrep_files(file, likely_lists)
482 if not match:482 if not match:
483 match = self.__fgrep_files(file, all_lists)483 match = self.__fgrep_files(file, all_lists)
484 # with usrmerge some binaries appear in usr but their .list file
485 # doesn't reflect that so strip the /usr from the path
486 if not match and file.startswith('/usr'):
487 file = file[4:]
488 match = self.__fgrep_files('%s' % file, likely_lists)
489 if not match:
490 match = self.__fgrep_files('%s' % file, all_lists)
484491
485 if match:492 if match:
486 return os.path.splitext(os.path.basename(match))[0].split(':')[0]493 return os.path.splitext(os.path.basename(match))[0].split(':')[0]
487494
=== modified file 'test/test_report.py'
--- test/test_report.py 2017-08-29 23:44:45 +0000
+++ test/test_report.py 2018-12-20 23:42:02 +0000
@@ -134,7 +134,7 @@
134 self.assertEqual(pr.pid, p.pid)134 self.assertEqual(pr.pid, p.pid)
135 p.communicate(b'\n')135 p.communicate(b'\n')
136 self.assertEqual(pr['ProcCmdline'], 'cat /foo\\ bar \\\\h \\\\\\ \\\\ -')136 self.assertEqual(pr['ProcCmdline'], 'cat /foo\\ bar \\\\h \\\\\\ \\\\ -')
137 self.assertEqual(pr['ExecutablePath'], '/bin/cat')137 self.assertEqual(pr['ExecutablePath'], '/usr/bin/cat')
138 self.assertNotIn('InterpreterPath', pr)138 self.assertNotIn('InterpreterPath', pr)
139 self.assertIn('/bin/cat', pr['ProcMaps'])139 self.assertIn('/bin/cat', pr['ProcMaps'])
140 self.assertIn('[stack]', pr['ProcMaps'])140 self.assertIn('[stack]', pr['ProcMaps'])
@@ -316,7 +316,7 @@
316 pr['ProcStatus'] = 'Name:\tzgrep'316 pr['ProcStatus'] = 'Name:\tzgrep'
317 pr['ProcCmdline'] = '/bin/sh\0/bin/zgrep\0foo'317 pr['ProcCmdline'] = '/bin/sh\0/bin/zgrep\0foo'
318 pr._check_interpreted()318 pr._check_interpreted()
319 self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')319 self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
320 self.assertEqual(pr['InterpreterPath'], '/bin/dash')320 self.assertEqual(pr['InterpreterPath'], '/bin/dash')
321321
322 # standard sh script when being called explicitly with interpreter322 # standard sh script when being called explicitly with interpreter
@@ -325,7 +325,7 @@
325 pr['ProcStatus'] = 'Name:\tdash'325 pr['ProcStatus'] = 'Name:\tdash'
326 pr['ProcCmdline'] = '/bin/sh\0/bin/zgrep\0foo'326 pr['ProcCmdline'] = '/bin/sh\0/bin/zgrep\0foo'
327 pr._check_interpreted()327 pr._check_interpreted()
328 self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')328 self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
329 self.assertEqual(pr['InterpreterPath'], '/bin/dash')329 self.assertEqual(pr['InterpreterPath'], '/bin/dash')
330330
331 # special case mono scheme: beagled-helper (use zgrep to make the test331 # special case mono scheme: beagled-helper (use zgrep to make the test
@@ -335,7 +335,7 @@
335 pr['ProcStatus'] = 'Name:\tzgrep'335 pr['ProcStatus'] = 'Name:\tzgrep'
336 pr['ProcCmdline'] = 'zgrep\0--debug\0/bin/zgrep'336 pr['ProcCmdline'] = 'zgrep\0--debug\0/bin/zgrep'
337 pr._check_interpreted()337 pr._check_interpreted()
338 self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')338 self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
339 self.assertEqual(pr['InterpreterPath'], '/usr/bin/mono')339 self.assertEqual(pr['InterpreterPath'], '/usr/bin/mono')
340340
341 # special case mono scheme: banshee (use zgrep to make the test341 # special case mono scheme: banshee (use zgrep to make the test
@@ -345,7 +345,7 @@
345 pr['ProcStatus'] = 'Name:\tzgrep'345 pr['ProcStatus'] = 'Name:\tzgrep'
346 pr['ProcCmdline'] = 'zgrep\0/bin/zgrep'346 pr['ProcCmdline'] = 'zgrep\0/bin/zgrep'
347 pr._check_interpreted()347 pr._check_interpreted()
348 self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')348 self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
349 self.assertEqual(pr['InterpreterPath'], '/usr/bin/mono')349 self.assertEqual(pr['InterpreterPath'], '/usr/bin/mono')
350350
351 # fail on files we shouldn't have access to when name!=argv[0]351 # fail on files we shouldn't have access to when name!=argv[0]
@@ -379,10 +379,10 @@
379 pr = apport.report.Report()379 pr = apport.report.Report()
380 pr['ExecutablePath'] = '/usr/bin/python'380 pr['ExecutablePath'] = '/usr/bin/python'
381 pr['ProcStatus'] = 'Name:\tpasswd'381 pr['ProcStatus'] = 'Name:\tpasswd'
382 pr['ProcCmdline'] = '../etc/passwd'382 pr['ProcCmdline'] = '../../etc/passwd'
383 pr._check_interpreted()383 pr._check_interpreted()
384 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')384 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')
385 self.assertEqual(pr['ExecutablePath'], '/bin/../etc/passwd')385 self.assertEqual(pr['ExecutablePath'], '/usr/bin/../../etc/passwd')
386386
387 # interactive python process387 # interactive python process
388 pr = apport.report.Report()388 pr = apport.report.Report()
@@ -400,7 +400,7 @@
400 pr['ProcCmdline'] = 'python\0/bin/bash'400 pr['ProcCmdline'] = 'python\0/bin/bash'
401 pr._check_interpreted()401 pr._check_interpreted()
402 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')402 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')
403 self.assertEqual(pr['ExecutablePath'], '/bin/bash')403 self.assertEqual(pr['ExecutablePath'], '/usr/bin/bash')
404404
405 # python script with options (abuse /bin/bash since it must exist)405 # python script with options (abuse /bin/bash since it must exist)
406 pr = apport.report.Report()406 pr = apport.report.Report()
@@ -409,7 +409,7 @@
409 pr['ProcCmdline'] = 'python\0-OO\0/bin/bash'409 pr['ProcCmdline'] = 'python\0-OO\0/bin/bash'
410 pr._check_interpreted()410 pr._check_interpreted()
411 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')411 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')
412 self.assertEqual(pr['ExecutablePath'], '/bin/bash')412 self.assertEqual(pr['ExecutablePath'], '/usr/bin/bash')
413413
414 # python script with a versioned interpreter414 # python script with a versioned interpreter
415 pr = apport.report.Report()415 pr = apport.report.Report()
@@ -418,7 +418,7 @@
418 pr['ProcCmdline'] = '/usr/bin/python\0/bin/bash'418 pr['ProcCmdline'] = '/usr/bin/python\0/bin/bash'
419 pr._check_interpreted()419 pr._check_interpreted()
420 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python2.7')420 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python2.7')
421 self.assertEqual(pr['ExecutablePath'], '/bin/bash')421 self.assertEqual(pr['ExecutablePath'], '/usr/bin/bash')
422422
423 # python script through -m423 # python script through -m
424 pr = apport.report.Report()424 pr = apport.report.Report()
@@ -2266,7 +2266,7 @@
2266 tmp_true = apport.report._which_extrapath('true', '/tmp')2266 tmp_true = apport.report._which_extrapath('true', '/tmp')
2267 os.unlink('/tmp/true')2267 os.unlink('/tmp/true')
2268 self.assertEqual(tmp_true, '/tmp/true')2268 self.assertEqual(tmp_true, '/tmp/true')
2269 self.assertEqual(bin_true, '/bin/true')2269 self.assertEqual(bin_true, '/usr/bin/true')
22702270
22712271
2272if __name__ == '__main__':2272if __name__ == '__main__':

Subscribers

People subscribed via source and target branches