Summary: | ASTERISK-19094: Incorrect -x command line parameter behavior | ||
Reporter: | Eugene (varnav) | Labels: | |
Date Opened: | 2011-12-21 21:08:33.000-0600 | Date Closed: | 2012-01-09 11:10:01.000-0600 |
Priority: | Major | Regression? | |
Status: | Closed/Complete | Components: | Core/General |
Versions: | 10.0.0 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | FreeBSD 8.2 x64 | Attachments: | ( 0) issueA19094_correct_asterisk_option_x.patch |
Description: | According to "man asterisk" -x command line parameter is used to execute a command in asterisk CLI and make output to STDout. But this parameter behavior is strange. Try: $asterisk -rx "core show version" - it will work $asterisk -x "core show version" - will give an error $asterisk -xr "core show version" - will give an error But in reality all three must work. | ||
Comments: | By: Walter Doekes (wdoekes) 2011-12-22 03:13:06.488-0600 Yes and no. > But in reality all three must work. Not quite. According to the manpage only these should work: asterisk -r -x COMMAND asterisk -x COMMAND Calling it like this: "asterisk -xr COMMAND" is simply shorthand for "asterisk -x -r COMMAND" {noformat} # asterisk -xr -r No such command 'r' (type 'core show help r' for other possible commands) # asterisk -x -r -r No such command '-r' (type 'core show help -r' for other possible commands) {noformat} (Where your additional command would get ignored, because asterisk ignores additional non-option parameters.) As for your observation about -x without anything else: yes. I cannot get any useful action from -x without -r. Even though it is listed in the manual. (Looking at 1.8.x.) {noformat} asterisk [-BcdfFghiImnpqRtTvVW] [-C file] [-e memory] [-G group] [-L loadaverage] [-M value] [-U user] [-s socket-file] asterisk -r [-v] [-d] [-x command] asterisk -R [-v] [-d] [-x command] {noformat} asterisk -h says something else: {noformat} -x <cmd> Execute command <cmd> (only valid with -r) {noformat} And the code does too: {code} case 'x': ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR); {code} If it did that the manual said, it should have a AST_OPT_FLAG_REMOTE too. Please try the attached patch. Regards, Walter By: Eugene (varnav) 2011-12-25 14:49:25.735-0600 It's fine now: -x works without r as it should. -rx works too -xr says: No such command 'r' (type 'core show help r' for other possible commands) But it's probably not incorrect because it interprets everything after x as commands. Thanks. I think this can be added to SVN. |