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

Proposed by Brian Murray on 2018-12-20
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 2018-12-20 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 on 2018-12-20

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
1=== modified file 'apport/report.py'
2--- apport/report.py 2018-05-09 23:30:27 +0000
3+++ apport/report.py 2018-12-20 23:42:02 +0000
4@@ -417,7 +417,7 @@
5 return
6
7 cmdargs = self['ProcCmdline'].split('\0')
8- bindirs = ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/']
9+ bindirs = ['/usr/bin/', '/usr/sbin/', '/bin/', '/sbin/']
10
11 # filter out interpreter options
12 while len(cmdargs) >= 2 and cmdargs[1].startswith('-'):
13
14=== modified file 'backends/packaging-apt-dpkg.py'
15--- backends/packaging-apt-dpkg.py 2018-12-20 17:45:47 +0000
16+++ backends/packaging-apt-dpkg.py 2018-12-20 23:42:02 +0000
17@@ -481,6 +481,13 @@
18 match = self.__fgrep_files(file, likely_lists)
19 if not match:
20 match = self.__fgrep_files(file, all_lists)
21+ # with usrmerge some binaries appear in usr but their .list file
22+ # doesn't reflect that so strip the /usr from the path
23+ if not match and file.startswith('/usr'):
24+ file = file[4:]
25+ match = self.__fgrep_files('%s' % file, likely_lists)
26+ if not match:
27+ match = self.__fgrep_files('%s' % file, all_lists)
28
29 if match:
30 return os.path.splitext(os.path.basename(match))[0].split(':')[0]
31
32=== modified file 'test/test_report.py'
33--- test/test_report.py 2017-08-29 23:44:45 +0000
34+++ test/test_report.py 2018-12-20 23:42:02 +0000
35@@ -134,7 +134,7 @@
36 self.assertEqual(pr.pid, p.pid)
37 p.communicate(b'\n')
38 self.assertEqual(pr['ProcCmdline'], 'cat /foo\\ bar \\\\h \\\\\\ \\\\ -')
39- self.assertEqual(pr['ExecutablePath'], '/bin/cat')
40+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/cat')
41 self.assertNotIn('InterpreterPath', pr)
42 self.assertIn('/bin/cat', pr['ProcMaps'])
43 self.assertIn('[stack]', pr['ProcMaps'])
44@@ -316,7 +316,7 @@
45 pr['ProcStatus'] = 'Name:\tzgrep'
46 pr['ProcCmdline'] = '/bin/sh\0/bin/zgrep\0foo'
47 pr._check_interpreted()
48- self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')
49+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
50 self.assertEqual(pr['InterpreterPath'], '/bin/dash')
51
52 # standard sh script when being called explicitly with interpreter
53@@ -325,7 +325,7 @@
54 pr['ProcStatus'] = 'Name:\tdash'
55 pr['ProcCmdline'] = '/bin/sh\0/bin/zgrep\0foo'
56 pr._check_interpreted()
57- self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')
58+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
59 self.assertEqual(pr['InterpreterPath'], '/bin/dash')
60
61 # special case mono scheme: beagled-helper (use zgrep to make the test
62@@ -335,7 +335,7 @@
63 pr['ProcStatus'] = 'Name:\tzgrep'
64 pr['ProcCmdline'] = 'zgrep\0--debug\0/bin/zgrep'
65 pr._check_interpreted()
66- self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')
67+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
68 self.assertEqual(pr['InterpreterPath'], '/usr/bin/mono')
69
70 # special case mono scheme: banshee (use zgrep to make the test
71@@ -345,7 +345,7 @@
72 pr['ProcStatus'] = 'Name:\tzgrep'
73 pr['ProcCmdline'] = 'zgrep\0/bin/zgrep'
74 pr._check_interpreted()
75- self.assertEqual(pr['ExecutablePath'], '/bin/zgrep')
76+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/zgrep')
77 self.assertEqual(pr['InterpreterPath'], '/usr/bin/mono')
78
79 # fail on files we shouldn't have access to when name!=argv[0]
80@@ -379,10 +379,10 @@
81 pr = apport.report.Report()
82 pr['ExecutablePath'] = '/usr/bin/python'
83 pr['ProcStatus'] = 'Name:\tpasswd'
84- pr['ProcCmdline'] = '../etc/passwd'
85+ pr['ProcCmdline'] = '../../etc/passwd'
86 pr._check_interpreted()
87 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')
88- self.assertEqual(pr['ExecutablePath'], '/bin/../etc/passwd')
89+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/../../etc/passwd')
90
91 # interactive python process
92 pr = apport.report.Report()
93@@ -400,7 +400,7 @@
94 pr['ProcCmdline'] = 'python\0/bin/bash'
95 pr._check_interpreted()
96 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')
97- self.assertEqual(pr['ExecutablePath'], '/bin/bash')
98+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/bash')
99
100 # python script with options (abuse /bin/bash since it must exist)
101 pr = apport.report.Report()
102@@ -409,7 +409,7 @@
103 pr['ProcCmdline'] = 'python\0-OO\0/bin/bash'
104 pr._check_interpreted()
105 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python')
106- self.assertEqual(pr['ExecutablePath'], '/bin/bash')
107+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/bash')
108
109 # python script with a versioned interpreter
110 pr = apport.report.Report()
111@@ -418,7 +418,7 @@
112 pr['ProcCmdline'] = '/usr/bin/python\0/bin/bash'
113 pr._check_interpreted()
114 self.assertEqual(pr['InterpreterPath'], '/usr/bin/python2.7')
115- self.assertEqual(pr['ExecutablePath'], '/bin/bash')
116+ self.assertEqual(pr['ExecutablePath'], '/usr/bin/bash')
117
118 # python script through -m
119 pr = apport.report.Report()
120@@ -2266,7 +2266,7 @@
121 tmp_true = apport.report._which_extrapath('true', '/tmp')
122 os.unlink('/tmp/true')
123 self.assertEqual(tmp_true, '/tmp/true')
124- self.assertEqual(bin_true, '/bin/true')
125+ self.assertEqual(bin_true, '/usr/bin/true')
126
127
128 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches