From: Zac Medico Date: Wed, 1 Feb 2012 02:04:11 +0000 (-0800) Subject: LinkageMapELF: handle null bytes in NEEDED.ELF.2 X-Git-Tag: v2.2.0_alpha85~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=972866403e8adc992625d2ff5e608c028b08bf30;p=portage.git 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 --- 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 " \