Description of problem: When condor_router_history is run with bad option like '-bad' it prints traceback instead of proper error message or a usage. Version-Release number of selected component (if applicable): condor-7.4.4-0.9 How reproducible: 100% Steps to Reproduce: 1. run 'condor_router_history -bad' # condor_router_history -bad Traceback (most recent call last): File "/usr/bin/condor_router_history", line 129, in ? options,args = getopt.getopt(sys.argv[1:],"h",long_options) File "/usr/lib64/python2.4/getopt.py", line 91, in getopt opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) File "/usr/lib64/python2.4/getopt.py", line 191, in do_shorts if short_has_arg(opt, shortopts): File "/usr/lib64/python2.4/getopt.py", line 207, in short_has_arg raise GetoptError('option -%s not recognized' % opt, opt) getopt.GetoptError: option -b not recognized Actual results: condor_router_history prints Traceback Expected results: error message or a usage should be printed Additional info:
https://condor-wiki.cs.wisc.edu/index.cgi/tktview?tn=2234
Upstream patch: https://condor-wiki.cs.wisc.edu/index.cgi/attach_get/375/gt2234-router-history-except repro/test: before fix, bad options yield a stack trace: $ condor_router_history --xxx Traceback (most recent call last): File "/usr/local/condor/bin/condor_router_history", line 129, in <module> options,args = getopt.getopt(sys.argv[1:],"h",long_options) File "/usr/lib64/python2.6/getopt.py", line 89, in getopt opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) File "/usr/lib64/python2.6/getopt.py", line 153, in do_longs has_arg, opt = long_has_args(opt, longopts) File "/usr/lib64/python2.6/getopt.py", line 170, in long_has_args raise GetoptError('option --%s not recognized' % opt, opt) getopt.GetoptError: option --xxx not recognized after fix, bad options yield error message with usage: $ condor_router_history --xxx Command line argument error: option --xxx not recognized USAGE: condor_router_history [OPTIONS] --show_records (show individual records in addition to summary) --show_iwd (when showing records, include working directory) --age=<days> (how many days ago end time should be) --days=<days> (how many days report should cover) --start="YYYY-MM-DD HH:MM" (date of start time of report) $ condor_router_history --age=xxx Command line argument error: invalid literal for float(): xxx USAGE: condor_router_history [OPTIONS] --show_records (show individual records in addition to summary) --show_iwd (when showing records, include working directory) --age=<days> (how many days ago end time should be) --days=<days> (how many days report should cover) --start="YYYY-MM-DD HH:MM" (date of start time of report)
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause: Argument handling exceptions in condor_router_history were not caught and handled. Consequence: Argument errors caused a stack dump instead of a helpful error message. Fix: Added proper exception handling around argument parsing. Result: Argument errors now are now handled gracefully with a helpful error message.
Fix pending upstream, targeted for 7.6.2
Tested on: $CondorVersion: 7.6.3 Jul 13 2011 BuildID: RH-7.6.3-0.2.el5 $ $CondorPlatform: I686-RedHat_5.7 $ $CondorVersion: 7.6.3 Jul 13 2011 BuildID: RH-7.6.3-0.2.el5 $ $CondorPlatform: X86_64-RedHat_5.7 $ $CondorVersion: 7.6.3 Jul 13 2011 BuildID: RH-7.6.3-0.2.el6 $ $CondorPlatform: I686-RedHat_6.1 $ $CondorVersion: 7.6.3 Jul 13 2011 BuildID: RH-7.6.3-0.2.el6 $ $CondorPlatform: X86_64-RedHat_6.1 $ $ condor_router_history -bad Command line argument error: option -b not recognized USAGE: condor_router_history [OPTIONS] --show_records (show individual records in addition to summary) --show_iwd (when showing records, include working directory) --age=<days> (how many days ago end time should be) --days=<days> (how many days report should cover) --start="YYYY-MM-DD HH:MM" (date of start time of report) You have new mail in /var/spool/mail/condor_user $ condor_router_history --days=x Command line argument error: invalid literal for float(): x USAGE: condor_router_history [OPTIONS] --show_records (show individual records in addition to summary) --show_iwd (when showing records, include working directory) --age=<days> (how many days ago end time should be) --days=<days> (how many days report should cover) --start="YYYY-MM-DD HH:MM" (date of start time of report) $ condor_router_history --days=0.01 Routed job history from 2011-07-26 16:44 to 2011-07-26 16:58 Site Hours Jobs Runs Completed Aborted ------------------------------------------------------- Site1 0 13 0 Site2 0 13 0 ------------------------------------------------------- TOTAL 0 26 0 >>> VERIFIED
Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1,11 +1 @@ -Cause: +Running the condor_router_history utility with incorrect argument values could have caused a stack dump due to uncaught argument-handling exceptions. Argument parsing now includes proper exception-handling routines so that command usage errors are now handled gracefully, and helpful error messages are printed to the console when an argument is incorrect.-Argument handling exceptions in condor_router_history were not caught and handled. - -Consequence: -Argument errors caused a stack dump instead of a helpful error message. - -Fix: -Added proper exception handling around argument parsing. - -Result: -Argument errors now are now handled gracefully with a helpful error message.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-1249.html