mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Make tags generated during component initialization stable.
The order in which the plugin initializers are executed is compiler dependent. With this change, Tags will always be generated in alphabetical ordering, not in compiler-dependent order.
This commit is contained in:
parent
2756dfe581
commit
65d977f278
13 changed files with 95 additions and 11 deletions
|
@ -238,6 +238,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
|
|||
|
||||
current_plugin->SetDynamic(true);
|
||||
current_plugin->DoConfigure();
|
||||
current_plugin->InitializeComponents();
|
||||
|
||||
if ( current_plugin->APIVersion() != BRO_PLUGIN_API_VERSION )
|
||||
reporter->FatalError("plugin's API version does not match Bro (expected %d, got %d in %s)",
|
||||
|
@ -328,9 +329,6 @@ void Manager::RegisterPlugin(Plugin *plugin)
|
|||
// A dynamic plugin, record its location.
|
||||
plugin->SetPluginLocation(current_dir, current_sopath);
|
||||
|
||||
// Sort plugins by name to make sure we have a deterministic order.
|
||||
ActivePluginsInternal()->sort(plugin_cmp);
|
||||
|
||||
current_plugin = plugin;
|
||||
}
|
||||
|
||||
|
@ -354,9 +352,21 @@ void Manager::InitPreScript()
|
|||
for ( plugin_list::iterator i = Manager::ActivePluginsInternal()->begin();
|
||||
i != Manager::ActivePluginsInternal()->end(); i++ )
|
||||
{
|
||||
Plugin* plugin = *i;
|
||||
plugin->DoConfigure();
|
||||
plugin->InitPreScript();
|
||||
(*i)->DoConfigure();
|
||||
}
|
||||
|
||||
// Sort plugins by name to make sure we have a deterministic order.
|
||||
// We cannot do this before, because the plugin name (used for plugin_cmp) is only
|
||||
// set in DoConfigure.
|
||||
// We need things sorted to generate the tags (in InitializeComponents) in a deterministic
|
||||
// order.
|
||||
ActivePluginsInternal()->sort(plugin_cmp);
|
||||
|
||||
for ( plugin_list::iterator i = Manager::ActivePluginsInternal()->begin();
|
||||
i != Manager::ActivePluginsInternal()->end(); i++ )
|
||||
{
|
||||
(*i)->InitializeComponents();
|
||||
(*i)->InitPreScript();
|
||||
}
|
||||
|
||||
init = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue