Fix syntax checking about xm dump-core
PATCH 1/1 Fix syntax checking about xm dump-core
Hi,
When I specified a wrong option to xm dump-core command, the Traceback occurred.
# xm dump-core vm1 -xyz Unexpected error: getopt.GetoptError
Please report to [email protected]
Traceback (most recent call last):
File "/usr/sbin/xm", line 10, in ?
main.main(sys.argv)
File "//usr/lib/python/xen/xm/main.py", line 1332, in main
rc = cmd(args)
File "//usr/lib/python/xen/xm/main.py", line 603, in xm_dump_core
(options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash'])
File "/usr/lib/python2.3/getopt.py", line 134, in gnu_getopt
opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) File "/usr/lib/python2.3/getopt.py", line 191, in do_shorts
if short_has_arg(opt, shortopts):
File "/usr/lib/python2.3/getopt.py", line 207, in short_has_arg
raise GetoptError('option -%s not recognized' % opt, opt)
getopt.GetoptError: option -x not recognized
This patch fixes the cause of Traceback.
Best regards,
Kan
tools/python/xen/xm/main.py +5 -2
@@ -599,8 +599,11 @@ def xm_dump_core(args): arg_check(args, "dump-core",1,3) live = False crash = False - import getopt - (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash']) + try: + (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash']) + except getopt.GetoptError, opterr: + err(opterr) + sys.exit(1) for (k, v) in options: if k in ['-L', '--live']:
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel