This bug caused great difficulty in determining the cause of the error message. This adds identifying code which states where the error message is coming from. It also adds the actual source which caused the error message in the first place. X-Gentoo-Bug: 542796 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=542796 X-Gentoo-forum-thread: https://forums.gentoo.org/viewtopic-t-1014842.html --- pym/portage/util/__init__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 48cd1b7..2ab38f3 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -777,6 +777,7 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True, _varexpand_word_chars = frozenset(string.ascii_letters + string.digits + "_") _varexpand_unexpected_eof_msg = "unexpected EOF while looking for matching `}'" +_varexpand_msgid = "portage.util varexpand(); " def varexpand(mystring, mydict=None, error_leader=None): if mydict is None: @@ -859,10 +860,11 @@ def varexpand(mystring, mydict=None, error_leader=None): while mystring[pos] in _varexpand_word_chars: if pos + 1 >= len(mystring): if braced: - msg = _varexpand_unexpected_eof_msg + msg = '%s\n %s' %(_varexpand_unexpected_eof_msg, + mystring) if error_leader is not None: msg = error_leader() + msg - writemsg(msg + "\n", noiselevel=-1) + writemsg(_varexpand_msgid + msg + "\n", noiselevel=-1) return "" else: pos += 1 @@ -871,10 +873,11 @@ def varexpand(mystring, mydict=None, error_leader=None): myvarname = mystring[myvstart:pos] if braced: if mystring[pos] != "}": - msg = _varexpand_unexpected_eof_msg + msg = '%s\n %s' %(_varexpand_unexpected_eof_msg, + mystring) if error_leader is not None: msg = error_leader() + msg - writemsg(msg + "\n", noiselevel=-1) + writemsg(_varexpand_msgid + msg + "\n", noiselevel=-1) return "" else: pos += 1 @@ -882,10 +885,10 @@ def varexpand(mystring, mydict=None, error_leader=None): msg = "$" if braced: msg += "{}" - msg += ": bad substitution" + msg += ": bad substitution for:\n %s" % mystring if error_leader is not None: msg = error_leader() + msg - writemsg(msg + "\n", noiselevel=-1) + writemsg(_varexpand_msgid + msg + "\n", noiselevel=-1) return "" numvars += 1 if myvarname in mydict: -- 2.3.4