Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 147785 - emerge script doesn't evaluate '\n'
Summary: emerge script doesn't evaluate '\n'
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 147007
  Show dependency tree
 
Reported: 2006-09-16 02:35 UTC by Jimmy.Jazz
Modified: 2007-01-13 06:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jimmy.Jazz 2006-09-16 02:35:11 UTC
Hello,

i found a minor layout bug that happened when you misconfigure PORTAGE_ELOG_MAILURI

emerge doesn't evaluate '\n' and returns,

"!!! A network error occur(r)ed while trying to send logmail:\n(-2, 'Name or service not known')\nSure you configured PORTAGE_ELOG_MAILURI correctly?"

Jj
Comment 1 Wiktor Wandachowicz 2006-09-16 07:12:20 UTC
Obviously, this message comes from send_mail function defined in
/usr/lib/portage/pym/portage_mail.py, where PortageException is raised
with the value containing several newline characters.

The problem shows up because the function elog_process defined in
/usr/lib/portage/pym/portage.py simply prints exceptions without any
conversion, whereas other code uses a little more sophisticated method:

(from elog_process)
except (ImportError, AttributeError), e:
 print "!!! Error while importing logging modules while loading \"mod_%s\":" % s
 print e
except portage_exception.PortageException, e:
 print e

(from class config/_init_dirs)
except portage_exception.PortageException, e:
 writemsg("!!! Directory initialization failed: '%s'\n" % mydir,
  noiselevel=-1)
 writemsg("!!! %s\n" % str(e),
  noiselevel=-1)

Looks like a simple conversion from "print" to analogous "writemsg"
calls in elog_process should do the trick.
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 08:07:49 UTC
Shouldn't matter as print implicitly calls str(e) (or rather e.__str__()) while writemsg has to do it explicitly. And the latest releases already use writemsg anyway.
The problem is somehow caused when assembling the Exception, have to test this some more.
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 08:23:42 UTC
Turned out the problem was actually in PortageException itself as it escaped newlines accidently.
Comment 4 Jimmy.Jazz 2007-01-11 09:29:51 UTC
(In reply to comment #3)
> Turned out the problem was actually in PortageException itself as it escaped
> newlines accidently.
> 
Glad to see you get time to trace the problem. Portage is a nice piece of code :)

Thank you for your effort.
Comment 5 Zac Medico gentoo-dev 2007-01-12 07:35:16 UTC
This is fixed in svn r5546.
Comment 6 Zac Medico gentoo-dev 2007-01-13 06:42:18 UTC
This has been released in 2.1.2_rc4-r9.