[asterisk-bugs] [JIRA] (ASTERISK-25585) rasterisk never hits most of main(), but it's assumed to
Asterisk Team (JIRA)
noreply at issues.asterisk.org
Sat Nov 21 17:43:33 CST 2015
[ https://issues.asterisk.org/jira/browse/ASTERISK-25585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=228412#comment-228412 ]
Asterisk Team commented on ASTERISK-25585:
------------------------------------------
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].
> rasterisk never hits most of main(), but it's assumed to
> --------------------------------------------------------
>
> Key: ASTERISK-25585
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-25585
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Reporter: Walter Doekes
> Severity: Minor
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list