Package: rss2email
Version: 1:2.54-2
Severity: minor
Tags: patch

The argument parsing of rss2email is not very reliable and dies with
exceptions when too few or wrong arguments are given:
743:[EMAIL PROTECTED]: ~] r2e email
Traceback (most recent call last):
  File "/usr/share/rss2email/rss2email.py", line 474, in ?
    email(args[0])
IndexError: list index out of range
747:[EMAIL PROTECTED]: ~] r2e delete
Traceback (most recent call last):
  File "/usr/share/rss2email/rss2email.py", line 485, in ?
    elif action == "delete": delete(int(args[0]))
IndexError: list index out of range
750:[EMAIL PROTECTED]: ~] r2e delete x
Traceback (most recent call last):
  File "/usr/share/rss2email/rss2email.py", line 485, in ?
    elif action == "delete": delete(int(args[0]))
ValueError: invalid literal for int(): x


The patch below fixes this, and updates the usage help text (the
argument to 'email' is not optional):


--- rss2email.py~       2005-06-11 23:29:11.693507376 +0100
+++ rss2email.py        2005-06-11 23:37:39.322336064 +0100
@@ -4,7 +4,7 @@
 
 Usage:
   new [youremail] (create new feedfile)
-  email [yournewemail] (update default email)
+  email yournewemail (update default email)
   run [--no-send] [num]
   add feedurl [youremail]
   list
@@ -471,7 +471,10 @@
                        else: run()
 
                elif action == "email":
-                       email(args[0])
+                       if not args:
+                               raise ie, "Action '%s' requires an argument" % 
action
+                       else:
+                               email(args[0])
 
                elif action == "add": add(*args)
 
@@ -482,7 +485,13 @@
 
                elif action == "list": list()
 
-               elif action == "delete": delete(int(args[0]))
+               elif action == "delete":
+                       if not args:
+                               raise ie, "Action '%s' requires an argument" % 
action
+                       elif args[0].isdigit():
+                               delete(int(args[0]))
+                       else:
+                               raise ie, "Action '%s' requires a number as its 
argument" % action
 
                else:
                        raise ie, "invalid action"



-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.10-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages rss2email depends on:
ii  python                        2.3.5-2    An interactive high-level object-o

-- no debconf information

-- 
Martin Michlmayr
http://www.cyrius.com/


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

Reply via email to