[asterisk-bugs] [JIRA] (ASTERISK-27773) Command line not being parsed correctly with getopt not from glibc
Asterisk Team (JIRA)
noreply at issues.asterisk.org
Mon Mar 26 06:46:39 CDT 2018
[ https://issues.asterisk.org/jira/browse/ASTERISK-27773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=242799#comment-242799 ]
Asterisk Team commented on ASTERISK-27773:
------------------------------------------
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].
> Command line not being parsed correctly with getopt not from glibc
> ------------------------------------------------------------------
>
> Key: ASTERISK-27773
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-27773
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Core/General
> Affects Versions: 15.0.0, 15.3.0
> Environment: FreeBSD 11.1
> Reporter: Guido Falsi
>
> Asterisk 15 intriduces a two step command line parsing with getopt(3). Before calling getopt for the second time optind = 0 is called to reset the parsing engine. This works with glibc getopt implementation since it forces optind = 1 when optind == 0 [1]. That's wrong with other implementations not forcing the value to 1.
> FreeBSD's getopt when getting optind == 0 checks if argv[0] is an option and since that fails (except the unrealistic case when argv[0][0] == '-') and stops parsing the rest of the command line. [2]
> I'm going to file patches on gerrit shortly.
> [1] https://github.com/bminor/glibc/blob/2d813d7b77ba8341a0a982d74bb59f5a0d775784/posix/getopt.c#L387
> [2] https://github.com/freebsd/freebsd/blob/5c40d602eef148e8d4231cda313ea122738096f4/lib/libc/stdlib/getopt.c#L72
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list