From 972866403e8adc992625d2ff5e608c028b08bf30 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 31 Jan 2012 18:04:11 -0800 Subject: [PATCH] LinkageMapELF: handle null bytes in NEEDED.ELF.2 This avoids an error from os.stat: TypeError: must be encoded string without NULL bytes, not str --- pym/portage/util/_dyn_libs/LinkageMapELF.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py index f7513573d..e71ac735a 100644 --- a/pym/portage/util/_dyn_libs/LinkageMapELF.py +++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py @@ -287,6 +287,13 @@ class LinkageMapELF(object): l = l.rstrip("\n") if not l: continue + if '\0' in l: + # os.stat() will raise "TypeError: must be encoded string + # without NULL bytes, not str" in this case. + writemsg_level(_("\nLine contains null byte(s) " \ + "in %s: %s\n\n") % (location, l), + level=logging.ERROR, noiselevel=-1) + continue fields = l.split(";") if len(fields) < 5: writemsg_level(_("\nWrong number of fields " \ -- 2.26.2