Bug#345998: enemies-of-carlotta: Use standard exit codes in --incoming mode

2006-01-07 Thread Tommi Virtanen
Lars Wirzenius wrote:
 EoC list: do you think anything depends on the current exit codes of the
 EoC command? Tommi especially, you have a habit of writing stuff on top
 of EoC.

I handle everything != 0 alike. This is all good for me.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#345998: enemies-of-carlotta: Use standard exit codes in --incoming mode

2006-01-06 Thread Lars Wirzenius
Erich filed a wishlist bug, with a patch, to make EoC use different exit
codes than before for certain situations. This has been mentioned
before, and I like the idea. My only worry is whether it is too big a
behavioral change to do for a 1.2 release.

EoC list: do you think anything depends on the current exit codes of the
EoC command? Tommi especially, you have a habit of writing stuff on top
of EoC.

ke, 2006-01-04 kello 19:59 +0100, Erich Schubert kirjoitti:
 Attached patch will use a short error reporting in --incoming mode,
 and use appropriate exit codes (from the os module) for common errors.
 When used as a postfix pipe transport, EoC used to report exceptions
 wrapped into a single line; thus causing a really ugly error message.
 
 by using appropriate exit codes in sys.exit(), postfix (as does
 procmail) understands what the type of error is, and will produce a
 nicer error message; by printing just a tiny bit of additional information
 this hopefully makes much more sense to the user:
   [EMAIL PROTECTED]: user unknown. Command output: Unknown list
 instead of
   [EMAIL PROTECTED]: Command died with status 1:
 /usr/bin/enemies-of-carlotta. Command output: Traceback (most recent 
 call
 last):   File /usr/bin/enemies-of-carlotta, line 16, in ?
 eoc.main(sys.argv[1:])   File /usr/share/enemies-of-carlotta/eoc.py, 
 line
 1645, in main mlm.incoming_message(skip_prefix, domain, moderate, 
 post)
 File /usr/share/enemies-of-carlotta/eoc.py, line 375, in 
 incoming_message
 domain)   File /usr/share/enemies-of-carlotta/eoc.py, line 313, in
 parse_recipient_address listname, parts = ap.parse(address)   File
 /usr/share/enemies-of-carlotta/eoc.py, line 181, in parse raise
 UnknownList(address) eoc.UnknownList: [EMAIL PROTECTED] is not a known
 mailing list

-- 
Programming should be fun, otherwise you're doing something wrong.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#345998: enemies-of-carlotta: Use standard exit codes in --incoming mode

2006-01-04 Thread Erich Schubert
Package: enemies-of-carlotta
Version: 1.2.1-1
Severity: wishlist
Tags: patch

Attached patch will use a short error reporting in --incoming mode,
and use appropriate exit codes (from the os module) for common errors.
When used as a postfix pipe transport, EoC used to report exceptions
wrapped into a single line; thus causing a really ugly error message.

by using appropriate exit codes in sys.exit(), postfix (as does
procmail) understands what the type of error is, and will produce a
nicer error message; by printing just a tiny bit of additional information
this hopefully makes much more sense to the user:
  [EMAIL PROTECTED]: user unknown. Command output: Unknown list
instead of
  [EMAIL PROTECTED]: Command died with status 1:
/usr/bin/enemies-of-carlotta. Command output: Traceback (most recent call
last):   File /usr/bin/enemies-of-carlotta, line 16, in ?
eoc.main(sys.argv[1:])   File /usr/share/enemies-of-carlotta/eoc.py, line
1645, in main mlm.incoming_message(skip_prefix, domain, moderate, post)
File /usr/share/enemies-of-carlotta/eoc.py, line 375, in incoming_message
domain)   File /usr/share/enemies-of-carlotta/eoc.py, line 313, in
parse_recipient_address listname, parts = ap.parse(address)   File
/usr/share/enemies-of-carlotta/eoc.py, line 181, in parse raise
UnknownList(address) eoc.UnknownList: [EMAIL PROTECTED] is not a known
mailing list

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.14
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages enemies-of-carlotta depends on:
ii  procmail  3.22-11Versatile e-mail processor
ii  python2.3.5-3An interactive high-level object-o

enemies-of-carlotta recommends no packages.

-- no debconf information
--- /usr/share/enemies-of-carlotta/eoc.py   2005-12-22 01:05:00.0 
+0100
+++ eoc.py  2006-01-04 19:57:00.0 +0100
@@ -1642,7 +1642,17 @@
 debug(Not a mailing list: %s % list_name)
 sys.exit(1)
 elif operation == --incoming:
-mlm.incoming_message(skip_prefix, domain, moderate, post)
+try:
+mlm.incoming_message(skip_prefix, domain, moderate, post)
+except BadCommandAddress:
+sys.stderr.write(Bad command address.\n)
+sys.exit(os.EX_NOUSER)
+except BadSignature:
+   sys.stderr.write(Bad signature.\n)
+sys.exit(os.EX_NOPERM)
+except UnknownList:
+sys.stderr.write(Unknown list\n)
+sys.exit(os.EX_NOUSER)
 elif operation == --cleaning-woman:
 mlm.cleaning_woman()
 elif operation == --show-lists: