Merge lp:~javier.collado/checkbox-core/bug991875 into lp:checkbox-core

Proposed by Javier Collado
Status: Merged
Merged at revision: 21
Proposed branch: lp:~javier.collado/checkbox-core/bug991875
Merge into: lp:checkbox-core
Diff against target: 16 lines (+4/-2)
1 file modified
checkbox/process/info.py (+4/-2)
To merge this branch: bzr merge lp:~javier.collado/checkbox-core/bug991875
Reviewer Review Type Date Requested Status
Marc Tardif Approve
Review via email: mp+104091@code.launchpad.net

Description of the change

Added check to make sure that entry.split("=", 1) works
when /proc/*/environ format isn't the expected one.

To post a comment you must log in.
Revision history for this message
Marc Tardif (cr3) wrote :

Good catch, merging!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox/process/info.py'
--- checkbox/process/info.py 2012-04-23 19:36:19 +0000
+++ checkbox/process/info.py 2012-04-30 11:20:37 +0000
@@ -183,8 +183,10 @@
183 pass183 pass
184 else:184 else:
185 # Convert NUL delimited strings to the usual format185 # Convert NUL delimited strings to the usual format
186 env_entries = env_buffer.split("\0")186 env_entries = [entry.split("=", 1)
187 env = dict((entry.split("=", 1)) for entry in env_entries if entry)187 for entry in env_buffer.split("\0") if entry]
188 env = dict(env_entry
189 for env_entry in env_entries if len(env_entry) == 2)
188190
189 # Filter and insert into pid environment table191 # Filter and insert into pid environment table
190 info.pid_env_id.filter_and_insert(env)192 info.pid_env_id.filter_and_insert(env)

Subscribers

People subscribed via source and target branches

to all changes: