Re: [Mailman-Users] [Mailman-Developers] Problems with uuencoded attachments

2006-01-15 Thread Tokio Kikuchi
Barry Warsaw wrote:
> On Mon, 2006-01-16 at 09:25 +0900, Tokio Kikuchi wrote:
> 
> 
>>In usual mailman qrunner execs, stderr is logged into logs/errors.  It 
>>is the additional tee_to_real_stderr in LogStdErr() setting which wants 
>>to print the error into real stderr.
>>
>>Isn't it safe to put the tee_to_real_stderr value 0 in bin/qrunner script ?
> 
> 
> Ideally, tee_to_real_stderr would be !AS_SUBPROC (i.e. tee when not
> running qrunner under mailmanctl).  That would have to be done in main()
> after processing the command line arguments.
> 
Yeah, I noticed that too and played around.  How about this patch.

I assumed running qrunner independently is for debugging purpose and
quit redirecting stderr into logs/error.

-- 
Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/
Index: qrunner
===
RCS file: /cvsroot/mailman/mailman/bin/qrunner,v
retrieving revision 2.9.2.1
diff -u -r2.9.2.1 qrunner
--- qrunner 27 Aug 2005 01:40:16 -  2.9.2.1
+++ qrunner 16 Jan 2006 01:58:49 -
@@ -66,6 +66,9 @@
 
 runner is required unless -l or -h is given, and it must be one of the names
 displayed by the -l switch.
+
+Note also that this script should be started up from mailmanctl as a normal
+operation.  It is only useful for debugging if it is run separately.
 """
 
 import sys
@@ -84,8 +87,6 @@
 # Flag which says whether we're running under mailmanctl or not.
 AS_SUBPROC = 0
 
-LogStdErr('error', 'qrunner', manual_reprime=0)
-
 
 
 def usage(code, msg=''):
@@ -212,6 +213,10 @@
 if len(runners) == 0:
 usage(1, _('No runner name given.'))
 
+# Before we startup qrunners, we redirect the stderr to mailman syslog.
+if AS_SUBPROC:
+LogStdErr('error', 'qrunner', manual_reprime=0, tee_to_real_stderr=0)
+
 # Fast track for one infinite runner
 if len(runners) == 1 and not once:
 qrunner = make_qrunner(*runners[0])
--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp

Re: [Mailman-Users] [Mailman-Developers] Problems with uuencoded attachments

2006-01-15 Thread Barry Warsaw
On Mon, 2006-01-16 at 09:25 +0900, Tokio Kikuchi wrote:

> In usual mailman qrunner execs, stderr is logged into logs/errors.  It 
> is the additional tee_to_real_stderr in LogStdErr() setting which wants 
> to print the error into real stderr.
> 
> Isn't it safe to put the tee_to_real_stderr value 0 in bin/qrunner script ?

Ideally, tee_to_real_stderr would be !AS_SUBPROC (i.e. tee when not
running qrunner under mailmanctl).  That would have to be done in main()
after processing the command line arguments.

-Barry



signature.asc
Description: This is a digitally signed message part
--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp

Re: [Mailman-Users] [Mailman-Developers] Problems with uuencoded attachments

2006-01-15 Thread Tokio Kikuchi
Barry Warsaw wrote:
> On Jan 14, 2006, at 9:59 PM, Tokio Kikuchi wrote:
> 
> 
>>Mark Sapiro wrote:
>>
>>
>>
File "/usr/lib/python2.3/uu.py", line 139, in decode
  sys.stderr.write("Warning: %s\n" % str(v))
File "/usr/lib/mailman/Mailman/Logging/MultiLogger.py", line 45,  
in write
  _logexc(logger, msg)
File "/usr/lib/mailman/Mailman/Logging/Utils.py", line 22, in  
_logexc
  sys.__stderr__.write('Logging error: %s\n' % logger)
IOError: [Errno 32] Broken pipe
>>
>>>I think this could be fixed by changing
>>>"/usr/lib/mailman/pythonlib/email/Message.py", line 223 from
>>>uu.decode(StringIO(payload+'\n'), sfp)
>>>to
>>>uu.decode(StringIO(payload+'\n'), sfp,  
>>>quiet=True)
>>
>>
>>There should be other chances that Python builtin modules spew  
>>warnings to sys.stderr.  How about this patch for Logging/Utils.py  
>>to write these messages into syslog facility.
> 
> 
> The only problem is that currently Mailman does not use the syslog  
> module, and I'm uncomfortable with adding it for this one situation  
> (are there others?).  We should definitely be passing the quiet flag  
> to uu.decode(), but OTOH maybe we should also be testing whether  
> sys.__stderr__ is detached and then redirecting that to logs/errors?
> 
In usual mailman qrunner execs, stderr is logged into logs/errors.  It 
is the additional tee_to_real_stderr in LogStdErr() setting which wants 
to print the error into real stderr.

Isn't it safe to put the tee_to_real_stderr value 0 in bin/qrunner script ?


-- 
Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/
--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp


Re: [Mailman-Users] [Mailman-Developers] Problems with uuencoded attachments

2006-01-15 Thread Barry Warsaw
On Jan 14, 2006, at 9:59 PM, Tokio Kikuchi wrote:

> Mark Sapiro wrote:
>
>
>>> File "/usr/lib/python2.3/uu.py", line 139, in decode
>>>   sys.stderr.write("Warning: %s\n" % str(v))
>>> File "/usr/lib/mailman/Mailman/Logging/MultiLogger.py", line 45,  
>>> in write
>>>   _logexc(logger, msg)
>>> File "/usr/lib/mailman/Mailman/Logging/Utils.py", line 22, in  
>>> _logexc
>>>   sys.__stderr__.write('Logging error: %s\n' % logger)
>>> IOError: [Errno 32] Broken pipe
>
>> I think this could be fixed by changing
>> "/usr/lib/mailman/pythonlib/email/Message.py", line 223 from
>> uu.decode(StringIO(payload+'\n'), sfp)
>> to
>> uu.decode(StringIO(payload+'\n'), sfp,  
>> quiet=True)
>
>
> There should be other chances that Python builtin modules spew  
> warnings to sys.stderr.  How about this patch for Logging/Utils.py  
> to write these messages into syslog facility.

The only problem is that currently Mailman does not use the syslog  
module, and I'm uncomfortable with adding it for this one situation  
(are there others?).  We should definitely be passing the quiet flag  
to uu.decode(), but OTOH maybe we should also be testing whether  
sys.__stderr__ is detached and then redirecting that to logs/errors?

-Barry

--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp