1 |
commit: 972866403e8adc992625d2ff5e608c028b08bf30 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 1 02:04:11 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 1 02:04:11 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=97286640 |
7 |
|
8 |
LinkageMapELF: handle null bytes in NEEDED.ELF.2 |
9 |
|
10 |
This avoids an error from os.stat: |
11 |
TypeError: must be encoded string without NULL bytes, not str |
12 |
|
13 |
--- |
14 |
pym/portage/util/_dyn_libs/LinkageMapELF.py | 7 +++++++ |
15 |
1 files changed, 7 insertions(+), 0 deletions(-) |
16 |
|
17 |
diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py |
18 |
index f751357..e71ac73 100644 |
19 |
--- a/pym/portage/util/_dyn_libs/LinkageMapELF.py |
20 |
+++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py |
21 |
@@ -287,6 +287,13 @@ class LinkageMapELF(object): |
22 |
l = l.rstrip("\n") |
23 |
if not l: |
24 |
continue |
25 |
+ if '\0' in l: |
26 |
+ # os.stat() will raise "TypeError: must be encoded string |
27 |
+ # without NULL bytes, not str" in this case. |
28 |
+ writemsg_level(_("\nLine contains null byte(s) " \ |
29 |
+ "in %s: %s\n\n") % (location, l), |
30 |
+ level=logging.ERROR, noiselevel=-1) |
31 |
+ continue |
32 |
fields = l.split(";") |
33 |
if len(fields) < 5: |
34 |
writemsg_level(_("\nWrong number of fields " \ |