WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-tools

[Xen-tools] [PATCH] xm: move bogus arg check inside lenth check

To: xen-tools@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-tools] [PATCH] xm: move bogus arg check inside lenth check
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Fri, 26 Aug 2005 15:21:58 -0500
Delivery-date: Fri, 26 Aug 2005 20:21:13 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-tools-request@lists.xensource.com?subject=help>
List-id: Xen control tools developers <xen-tools.lists.xensource.com>
List-post: <mailto:xen-tools@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-tools>, <mailto:xen-tools-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-tools-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
I encountered the following error with xm:

(bebop) xm-test # xm list
Traceback (most recent call last):
  File "/usr/sbin/xm", line 10, in ?
    main.main(sys.argv)
  File 
"/home/rharper/work/openhype/xen/unstable/hg/hotplug/dist/install/usr/lib/python/xen/xm/main.py",
 line 718, in main
    if args[0] == "bogus":
IndexError: list index out of range

Moving the bogus check inside the length check cleans that up.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 main.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 2b95125015a5 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Aug 26 13:06:49 2005
+++ b/tools/python/xen/xm/main.py       Fri Aug 26 15:16:21 2005
@@ -715,9 +715,9 @@
             err("Most commands need root access.  Please try again as root")
             sys.exit(1)
         except XendError, ex:
-            if args[0] == "bogus":
-                args.remove("bogus")
             if len(args) > 0:
+                if args[0] == "bogus":
+                    args.remove("bogus")
                 handle_xend_error(argv[1], args[0], ex)
             else:
                 print "Unexpected error:", sys.exc_info()[0]

_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-tools] [PATCH] xm: move bogus arg check inside lenth check, Ryan Harper <=