Summary: | ASTERISK-25585: [patch]rasterisk never hits most of main(), but it's assumed to | ||||||
Reporter: | Walter Doekes (wdoekes) | Labels: | |||||
Date Opened: | 2015-11-21 17:42:29.000-0600 | Date Closed: | 2015-11-25 22:19:57.000-0600 | ||||
Priority: | Minor | Regression? | |||||
Status: | Closed/Complete | Components: | Core/General | ||||
Versions: | 11.20.0 13.6.0 | Frequency of Occurrence | |||||
Related Issues: |
| ||||||
Environment: | Attachments: | ||||||
Description: | If you look at (Asterisk 11) main/asterisk.c main(), halfway, you see this:
{code} ... if (ast_tryconnect()) { /* One is already running */ if (ast_opt_remote) { multi_thread_safe = 1; if (ast_opt_exec) { ast_remotecontrol(xarg); quit_handler(0, SHUTDOWN_FAST, 0); exit(0); } print_intro_message(runuser, rungroup); printf("%s", term_quit()); ast_remotecontrol(NULL); quit_handler(0, SHUTDOWN_FAST, 0); exit(0); } else { fprintf(stderr, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET); printf("%s", term_quit()); exit(1); } } else if (ast_opt_remote || ast_opt_exec) { fprintf(stderr, "Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET); printf("%s", term_quit()); exit(1); } ... {code} If we're an rasterisk call, we either exit 0 or exit 1, but we never pass this bit. However, later on, things appear like: {code} ast_term_init(); {code} And: {code} } else if (ast_opt_remote && (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n", {code} That last bit looks like dead code, but the ast_term_init itself looks like it wants to be called for rasterisk instances as well: {code} if (!ast_opt_console) { /* If any remote console is not compatible, we'll strip the color codes at that point */ vt100compat = 1; goto end; } {code} If rasterisk, then !ast_opt_console, is what I'm thinking. In any case, this revealed itself when someone was trying to use the colored prompt function in their asterisk {{ASTERISK_PROMPT="%C31*CLI>%C5 " asterisk -r}} -- which is a bad idea, but that's another matter. In this case, because ast_term_init was not called, vt100compat is not 1 and the colored prompt would be colorless. Thus, two issues: * Dead code in main(). * ast_term_init is not called for rasterisk. | ||||||
Comments: | By: Asterisk Team (asteriskteam) 2015-11-21 17:42:30.638-0600 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. |