You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/04/14 21:16:25 UTC
[jira] [Commented] (TS-3245) getopt doesn't work correctly when
used in plugin chaining
[ https://issues.apache.org/jira/browse/TS-3245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15241756#comment-15241756 ]
ASF GitHub Bot commented on TS-3245:
------------------------------------
GitHub user pbchou opened a pull request:
https://github.com/apache/trafficserver/pull/571
TS-3245 : Changes optind = 1 to optind = 0 for all plugins to ensure
that multiples plugins in the global plugin.config can co-exist
together. Note that all plugins were already optind = 0 except
for the four that were modified in the this commit (background_fetch,
regex_revalidate, remap_stats, and stale_while_revalidate).
Note: This patch does NOT change ATS core so that future plugins
must be sure to use optind = 0 also.
Understood preference is for ATS core change to cover all plugins, but this has been outstanding for more than one year and affects our usage of ATS. Also, I am not sure if an ATS core change can cover the plugins since according to the Linux man page setting optind=0 and calling getopt_long() causes an "internal" initialization process to run which looks at the optstring argument to getopt_long(). ATS core would not have pre-knowledge of each plugin's internals so this seems like this would be a road-block?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/pbchou/trafficserver TS-3245
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/571.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #571
----
commit a5141b2a90206d439841e1bd96aa5e8b15bcc9dd
Author: Peter Chou <pb...@labs.att.com>
Date: 2016-04-12T18:34:01Z
TS-3245 : Changes optind = 1 to optind = 0 for all plugins to ensure
that multiples plugins in the global plugin.config can co-exist
together. Note that all plugins were already optind = 0 except
for the four that were modified in the this commit (background_fetch,
regex_revalidate, remap_stats, and stale_while_revalidate).
Note: This patch does NOT change ATS core so that future plugins
must be sure to use optind = 0 also.
----
> getopt doesn't work correctly when used in plugin chaining
> ----------------------------------------------------------
>
> Key: TS-3245
> URL: https://issues.apache.org/jira/browse/TS-3245
> Project: Traffic Server
> Issue Type: Improvement
> Components: Plugins
> Affects Versions: 5.1.1
> Reporter: Sudheer Vinukonda
> Priority: Minor
> Labels: newbie
> Fix For: sometime
>
>
> When multiple plugins that use getopt are chained, it doesn't work correctly for the subsequent plugins after the first plugin. [~jpeach@apache.org] and [~zwoop] suggested that the getopt globals need to be reset (example, {{optind = opterr = optopt = 0}}) before using it and would be better to do it in the core during plugin loading to keep it simple/transparent from plugin development.
> Note that, if a plugin itself uses getopt multiple times on different argv's, it would have to reset the globals between them.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)