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-11 Versatile e-mail processor ii python 2.3.5-3 An 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.000000000 +0100 +++ eoc.py 2006-01-04 19:57:00.000000000 +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":