mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
plugin/Manager: Warn when plugin with the same name is found
This was brought up on Slack as a potential source of confusion during development as it's not visible when plugin directories are ignored outside of looking into the plugin debug stream. I'd actually prefer to just FatalError() this, but a warning seems reasonably visible for interactive usage.
This commit is contained in:
parent
c873857953
commit
fdd6dfd096
3 changed files with 16 additions and 3 deletions
|
@ -112,10 +112,10 @@ void Manager::SearchDynamicPlugins(const std::string& dir)
|
||||||
if ( name.empty() )
|
if ( name.empty() )
|
||||||
reporter->FatalError("empty plugin magic file %s", magic.c_str());
|
reporter->FatalError("empty plugin magic file %s", magic.c_str());
|
||||||
|
|
||||||
if ( dynamic_plugins.find(lower_name) != dynamic_plugins.end() )
|
if ( const auto& other = dynamic_plugins.find(lower_name); other != dynamic_plugins.end() )
|
||||||
{
|
{
|
||||||
DBG_LOG(DBG_PLUGINS, "Found already known plugin %s in %s, ignoring", name.c_str(),
|
reporter->Warning("ignoring dynamic plugin %s from %s, already found in %s",
|
||||||
dir.c_str());
|
name.c_str(), dir.c_str(), other->second.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
testing/btest/Baseline/plugins.duplicate-pktsrc/output
Normal file
5
testing/btest/Baseline/plugins.duplicate-pktsrc/output
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
warning in <...>/init-bare.zeek, line 1: ignoring dynamic plugin Demo::Foo from <...>/build, already found in <...>/build_backup
|
||||||
|
Demo::Foo - A Foo packet source (dynamic, version 1.0.0)
|
||||||
|
[Packet Source] FooPktSrc (interface prefix "foo"; supports live and trace input)
|
||||||
|
|
8
testing/btest/plugins/duplicate-pktsrc.zeek
Normal file
8
testing/btest/plugins/duplicate-pktsrc.zeek
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# @TEST-DOC: Loading two plugins with the same name triggers a warning.
|
||||||
|
|
||||||
|
# @TEST-EXEC: ${DIST}/auxil/zeek-aux/plugin-support/init-plugin -u . Demo Foo
|
||||||
|
# @TEST-EXEC: cp -r %DIR/pktsrc-plugin/* .
|
||||||
|
# @TEST-EXEC: ./configure --zeek-dist=${DIST} && make
|
||||||
|
# @TEST-EXEC: cp -R build build_backup
|
||||||
|
# @TEST-EXEC: ZEEK_PLUGIN_PATH=`pwd`/build_backup:`pwd`/build zeek -NN Demo::Foo >output 2>&1
|
||||||
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
Loading…
Add table
Add a link
Reference in a new issue