You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@xbc.nu> on 2003/01/10 00:00:34 UTC

Re: svn commit: rev 4317 - trunk/tools/hook-scripts

gstein@tigris.org wrote:

>+# ------------------------------------------------------------------------
>+# TODO
>+#
>+# * pipe output into a mail program (and avoid os.popen)
>

Wouldn't using the smtplib.SMTP class be best? Then the mailer.py script
wouldn't depend on the availability of a particular (unix) mail program.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4317 - trunk/tools/hook-scripts

Posted by ender <en...@objectrealms.net>.
On Thursday 09 January 2003 04:41 pm, Branko Čibej wrote:
> ender wrote:
> >On Thursday 09 January 2003 04:00 pm, Branko Čibej wrote:
> >>gstein@tigris.org wrote:
> >>>+#
> >>>------------------------------------------------------------------------
> >>>+# TODO
> >>>+#
> >>>+# * pipe output into a mail program (and avoid os.popen)
> >>
> >>Wouldn't using the smtplib.SMTP class be best? Then the mailer.py script
> >>wouldn't depend on the availability of a particular (unix) mail program.
> >
> >moving to smtp would definitely be better for portability, but another
> > issue is that by using the (unix) mail program (s), you can inject
> > directly into the mta queue, which for some edge cases is a better thing
> > to do if a direct smtp socket connection is not possible such that the
> > message isn't lost.
>
> It also makes the script terminally impossible to use on Windows. Well,
> either that, or introduce platform-specific code there. Is making a SMTP
> connection to localhost much different than piping through mailx?

imo, its better to go with smtp for portability, and the possibility of 
directing to non local mailhosts, previously, i just wanted to bring up one 
possible reason, why going through a mailer program would be better... ie if 
the mailer program did direct injection into the mta queue, than it would be 
more robust in cases of server or network problems. on a whole using smtplib 
gives a bit more flexibility and portability.

-e




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4317 - trunk/tools/hook-scripts

Posted by Nuutti Kotivuori <na...@iki.fi>.
Branko wrote:
> It also makes the script terminally impossible to use on Windows. Well,
> either that, or introduce platform-specific code there. Is making a SMTP
> connection to localhost much different than piping through mailx?

I think so - I personally have had several use cases where it did
matter that was it through SMTP or 'sendmail' lookalike locally.

So, if possible - implement three choices - local mda invoked as a
process, SMTP connection and LMTP connection. If it's too much
work, I don't really care which one of the options is picked.

-- Naked


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4317 - trunk/tools/hook-scripts

Posted by Branko Čibej <br...@xbc.nu>.
ender wrote:

>On Thursday 09 January 2003 04:00 pm, Branko Čibej wrote:
>  
>
>>gstein@tigris.org wrote:
>>    
>>
>>>+#
>>>------------------------------------------------------------------------
>>>+# TODO
>>>+#
>>>+# * pipe output into a mail program (and avoid os.popen)
>>>      
>>>
>>Wouldn't using the smtplib.SMTP class be best? Then the mailer.py script
>>wouldn't depend on the availability of a particular (unix) mail program.
>>    
>>
>
>moving to smtp would definitely be better for portability, but another issue 
>is that by using the (unix) mail program (s), you can inject directly into 
>the mta queue, which for some edge cases is a better thing to do if a direct 
>smtp socket connection is not possible such that the message isn't lost.
>  
>

It also makes the script terminally impossible to use on Windows. Well,
either that, or introduce platform-specific code there. Is making a SMTP
connection to localhost much different than piping through mailx?

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4317 - trunk/tools/hook-scripts

Posted by ender <en...@objectrealms.net>.
On Thursday 09 January 2003 04:00 pm, Branko Čibej wrote:
> gstein@tigris.org wrote:
> >+#
> > ------------------------------------------------------------------------
> > +# TODO
> >+#
> >+# * pipe output into a mail program (and avoid os.popen)
>
> Wouldn't using the smtplib.SMTP class be best? Then the mailer.py script
> wouldn't depend on the availability of a particular (unix) mail program.

moving to smtp would definitely be better for portability, but another issue 
is that by using the (unix) mail program (s), you can inject directly into 
the mta queue, which for some edge cases is a better thing to do if a direct 
smtp socket connection is not possible such that the message isn't lost.

-e

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4317 - trunk/tools/hook-scripts

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Jan 10, 2003 at 01:00:34AM +0100, Branko Cibej wrote:
> gstein@tigris.org wrote:
> 
> >+# ------------------------------------------------------------------------
> >+# TODO
> >+#
> >+# * pipe output into a mail program (and avoid os.popen)
> >
> 
> Wouldn't using the smtplib.SMTP class be best? Then the mailer.py script
> wouldn't depend on the availability of a particular (unix) mail program.

For efficiency? Nope. I'd have to write loops like this:

  smtp = MySMTPSubclass(...)
  while 1:
    chunk = pipe.read(CHUNK_SIZE)
    if not chunk:
      break
    smtp.write_DATA(chunk)

The subclass is needed cuz you can't send a DATA except as one big string. I
want to stream it. Even then, a bunch of escaping is needed during the
delivery of that string.

My plan was to pipe the output of the diff subprocess right into stdin of
the mailer subprocess. I can also arrange to do that for N diff processes
all going into one mailer. The problem is that Windows can't really support
the pipes, fork, and descriptor duplication that is necessary for that.

That said: if somebody wants to tweak the code to enable SMTP handling?
Fine. I'm just not too interested in it. And yes, that means the script
won't work on Windows until somebody *does* do that.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org