Package: monkeysign
Version: 2.x
Severity: normal

Hi there,

I've been using monkeysign 2.x (from git repos) and by making a user
error, I've actually hit some real uglyness from python's smtplib that
crackles up all the way to the user:

if you give some string that smtplib doesn't like as the value to
--smtpserver (or -s) you end up getting a stack trace that says
"socket.gaierror: [Errno -2] Name or service not known" (does not
specify what host:port tuple was used for establishing a connection).

Now even though it's a bit ugly and unsettling for normal users, it's
still a bit useful to developers.

however, turning on debug for monkeysphere doesn't actually turn on
debugging in smtplib until the smtp connection was established. so we
can't get more help there.

that's because of how badly the interface of smtplib is designed:

 * constructor forces an SMTP connection right away if host string is
   provided, but
 * constructor does not accept a debug level to set it while
   instantiating.

So ppl trying to find out what is happening are at a loss.

I believe the correct workaround would be to change the smtplib.SMTP
class instantiation to something like the following:

   server = smtplib.SMTP()  # DONT pass in host string here
   server.set_debuglevel(self.options.debug)
   # to be nicer to users, we could catch socket.error exceptions from
   # server.connect() here and display a meaningful message to stderr.
   (code, msg) = server.connect(self.options.smtpserver)
   if code != 220:
       self.warn(_("Connection to SMTP server '%s' was unsuccessful: %s
%s" (self.options.smtpserver, code, msg)))
       # quit somehow at this point.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to