diff --git a/CHANGES b/CHANGES index 41c7092fd9..9d33f4c6b0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,35 @@ +6.1.0-dev.76 | 2023-06-15 18:36:25 +0200 + + * plugin/Manager: Warn when plugin with the same name is found (Arne Welzel, Corelight) + + 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. + + * Options: Do not output full usage on --test error (Arne Welzel, Corelight) + + ...mostly because the usage output is very long and the actual useful + error message scrolls off the screen. + + * GH-3090: CMakeLists: Propagate DOCTEST defines to external plugins (Arne Welzel, Corelight) + + If Zeek has not been built with doctest enabled then it's not easy + to run a plugin's tests (and if they really wanted to they could + again undef the DOCTEST_CONFIG_DISABLE and provide their own doctest + main() implementation. + + * GH-3090: CMakeLists: Add rapidjson/include to zeek_dynamic_plugin_base (Arne Welzel, Corelight) + + threading/formatters/JSON.h has a rapidjson include. Extend the + include directories of external plugins so they are setup to find + these in Zeek's install tree. + + * GH-3090: ZeekPluginBootstrap: Encode Zeek's CMAKE_BUILD_TYPE (Arne Welzel, Corelight) + + ...and bump cmake to have plugin's make use of it. + 6.1.0-dev.66 | 2023-06-14 10:09:46 -0700 * Change table initialization deprecation to error (Tim Wojtulewicz, Corelight) diff --git a/VERSION b/VERSION index 40770f8ef8..d3475505af 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1.0-dev.66 +6.1.0-dev.76 diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index 3d4f84b653..3f0d4a72bc 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -112,10 +112,10 @@ void Manager::SearchDynamicPlugins(const std::string& dir) if ( name.empty() ) 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(), - dir.c_str()); + reporter->Warning("ignoring dynamic plugin %s from %s, already found in %s", + name.c_str(), dir.c_str(), other->second.c_str()); return; } diff --git a/testing/btest/Baseline/plugins.duplicate-pktsrc/output b/testing/btest/Baseline/plugins.duplicate-pktsrc/output new file mode 100644 index 0000000000..19f5d4978e --- /dev/null +++ b/testing/btest/Baseline/plugins.duplicate-pktsrc/output @@ -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) + diff --git a/testing/btest/plugins/duplicate-pktsrc.zeek b/testing/btest/plugins/duplicate-pktsrc.zeek new file mode 100644 index 0000000000..aecc6190c6 --- /dev/null +++ b/testing/btest/plugins/duplicate-pktsrc.zeek @@ -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