Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 89485 - Error in new CVS logging with regards to mail
Summary: Error in new CVS logging with regards to mail
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-17 22:09 UTC by Alec Warner (RETIRED)
Modified: 2005-04-24 21:20 UTC (History)
0 users

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


Attachments
Adds a catch-all exception that raises a general exception. (mod-mail-exception.patch,361 bytes, patch)
2005-04-24 21:01 UTC, Alec Warner (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Warner (RETIRED) archtester gentoo-dev Security 2005-04-17 22:09:47 UTC
If PORT_LOG_SYSTEM is set to mail but PORTAGE_LOG_MAILURI isn't set portage barfs at the SMTP level, getting a connection refused message.  Portage should check that both are set before trying and throw an appropriate exception in the base that the latter is not set to anything.

kyoto root # cat /etc/make.conf | grep LOG
# PORT_LOGDIR is the location where portage will store all the logs it
PORT_LOGDIR=/var/log/portage
# CVS LOGGING
# PORTAGE_LOG_CLASSES: selects messages to be logged, possible values are:
PORTAGE_LOG_CLASSES="log info warn error"
# PORTAGE_LOG_SYSTEM: selects the module(s) to process the log messages. Modules
#                     custom (passes all messages to $PORTAGE_LOG_COMMAND)
#                     in $PORTAGE_LOG_MAILURI)
PORTAGE_LOG_SYSTEM="save mail syslog"
# PORTAGE_LOG_COMMAND: only used with the "custom" logging module. Specifies a $
#                          ${LOGFILE} - absolute path to the logfile
#PORTAGE_LOG_COMMAND="/path/to/logprocessor -p ${PACKAGE} -f ${LOGFILE}
# PORTAGE_LOG_MAILURI: this variable holds all important settings for the mail
#PORTAGE_LOG_MAILURI="root@localhost localhost" (this is also the default setti$
#PORTAGE_LOG_MAILURI="user@some.domain mail.some.domain" (sends mails to user@s$
#PORTAGE_LOG_MAILURI="user@some.domain user:secret@mail.some.domain:100465" (th$

kyoto root # emerge genlop
Calculating dependencies ...done!
>>> emerge (1 of 1) app-portage/genlop-0.30.2 to /
>>> md5 src_uri ;-) genlop-0.30.2.tar.gz
<snip>
>>> Regenerating /etc/ld.so.cache...
 * Caching service dependencies...
>>> app-portage/genlop-0.30.2 merged.
Traceback (most recent call last):
  File "/usr/bin/emerge", line 3590, in ?
    mydepgraph.merge(mydepgraph.altlist())
  File "/usr/bin/emerge", line 1902, in merge
    retval=portage.pkgmerge(mytbz2,myroot,self.pkgsettings)
  File "/usr/lib/portage/pym/portage.py", line 4961, in pkgmerge
    mylink.merge(pkgloc,infloc,myroot,myebuild,cleanup=1)
  File "/usr/lib/portage/pym/portage.py", line 4859, in merge
    return self.treewalk(mergeroot,myroot,inforoot,myebuild,cleanup=cleanup)
  File "/usr/lib/portage/pym/portage.py", line 4562, in treewalk
    elog_process(self.mycpv, self.settings)
  File "/usr/lib/portage/pym/portage.py", line 366, in elog_process
    m.process(mysettings, cpv, mylogentries, fulllog)
  File "/usr/lib/portage/pym/elog_modules/mod_mail.py", line 45, in process
    myconn = smtplib.SMTP(mymailhost, mymailport)
  File "/usr/lib/python2.3/smtplib.py", line 240, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.3/smtplib.py", line 302, in connect
    raise socket.error, msg
socket.error: (111, 'Connection refused')

kyoto root # emerge info
Portage 1.586-cvs (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.10-gentoo-r6 i686)
=================================================================
System uname: 2.6.10-gentoo-r6 i686 AMD Athlon(tm) XP 1800+
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4-r1 [2.3.4 (#1, Mar  5 2005, 02:36:29)]
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache: No such file or directory [disabled]
dev-lang/python:     2.3.4-r1
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.8.5-r3, 1.5, 1.7.9-r1, 1.6.3, 1.4_p6, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.14
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="no"
CFLAGS="-mcpu=athlon-xp -march=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-mcpu=athlon-xp -march=athlon-xp -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg confcache digest distlocks parallel-fetch sandbox sfperms userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.chem.wisc.edu/gentoo ftp://gentoo.chem.wisc.edu/gentoo"
MAKEOPTS="-j2"
PKGDIR="/home/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="x86 3dnow X acpi alsa apm arts avi bash-completion berkdb bitmap-fonts bmp canna caps cdr cjk crypt curl dvd dvdr dvdread emboss encode esd ethereal fam foomaticdb fortran gdbm gif gpm gtk gtk2 imagemagick imap imlib ipv6 jpeg kde libg++ libwww lm_sensors mad maildir matroska mikmod mmx mono motif mp3 mpeg mysql ncurses nis nls nptl offensive ogg oggvorbis openal opengl pam pdflib perl png posix python qt quicktime readline real sdl spell sse ssl svg svga tcltk tcpd threads tiff truetype truetype-fonts type1-fonts vorbis wxwindows xml xml2 xmms xv zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS

Config files: /etc/make.conf, /etc/portage/bashrc, /etc/portage/package.mask, /etc/portage/package.unmask, /etc/portage/package.keywords, /etc/portage/profile/virtuals
Comment 1 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-04-17 22:24:55 UTC
Errrr, as I am educated by genone, localhost:25 is the default, which is why this gets past some code checks.  However the exception handler in mod_mail.py doesn't seem to be working properly.  It should catch the socket exception and reraise as a generic portage exception with a helpful error message which it does not do.  Not sure why, the classes for the exceptions look correct.
Comment 2 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-04-24 21:01:46 UTC
Created attachment 57141 [details, diff]
Adds a catch-all exception that raises a general exception.

This should obviously catch the socket exception, odd that smtplib doesn't
catch and reraise as it's own which would make more sense, but we can't go
redistributing smtplib, so I guess this will have to do.  Not sure if you want
a more specific exception class or not though.
Comment 3 Marius Mauch (RETIRED) gentoo-dev 2005-04-24 21:18:27 UTC
I already fixed that a few days ago, it's a corner case in smtplib.
Btw, catch-all is bad as some normal events are also exceptions (like sys.exit).
Comment 4 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-04-24 21:20:34 UTC
I know about sys.exit(), but not sure what other exceptions smtplib might throw, although they could always be dealt with later as they pop up ( if at all ).