[asterisk-bugs] [JIRA] (ASTERISK-27773) Command line not being parsed correctly with getopt not from glibc
Chris Savinovich (JIRA)
noreply at issues.asterisk.org
Thu Apr 19 13:30:55 CDT 2018
[ https://issues.asterisk.org/jira/browse/ASTERISK-27773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chris Savinovich updated ASTERISK-27773:
----------------------------------------
Target Release Version/s: 15.4.0
> 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: 14.7.6, 15.0.0, 15.3.0
> Environment: FreeBSD 11.1
> Reporter: Guido Falsi
> Assignee: Guido Falsi
> Target Release: 15.4.0
>
>
> 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