Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin: zkg install / make install installing wrong scripts #35

Open
awelzel opened this issue Jun 19, 2024 · 0 comments · May be fixed by #37
Open

plugin: zkg install / make install installing wrong scripts #35

awelzel opened this issue Jun 19, 2024 · 0 comments · May be fixed by #37
Assignees

Comments

@awelzel
Copy link
Contributor

awelzel commented Jun 19, 2024

I believe the culprit here is the CMake revamp removing support for BRO_PLUGIN_BASE, but opening a ticket in the template repo as I'm not sure we want to reintroduce that and/or maybe there's a better idea how to go about that.

Today, when creating a package with a plugin feature, there's two scripts directories - top-level and plugin specific.

~/foobar$ tree scripts/ ./plugin
scripts/
├── __load__.zeek
└── main.zeek
./plugin
├── scripts
│   ├── __load__.zeek
│   ├── __preload__.zeek
│   └── types.zeek
└── src
    ├── config.h.in
     ...

When running zkg install (or make install within build), the scripts/ directory next to the installed lib/ directory contains the content of the top-level ./scripts directory rather than ./plugin/scripts (which would have the __preload__.zeek or types.zeek files). This seems wrong: The plugin/scripts should've been sued for this.

Concretely, after a make install within ./build:

/opt/zeek-6.2/lib/zeek/plugins/Zeek_FooBar/
├── COPYING
├── lib
│   ├── bif
│   │   ├── foobar.bif.zeek
│   │   └── __load__.zeek
│   └── Zeek-FooBar.linux-x86_64.so
├── README
├── scripts
│   ├── __load__.zeek
│   └── main.zeek
├── VERSION
└── __zeek_plugin__

So 1) we won't have and load the right __load__.zeek, __preload__.zeek and types.zeek files automatically when the shared library is loaded and also 2) Zeek automatically attempts to load the top-level ./scripts directory instead (which should require an explicit @load).

$ zeek -e 'event zeek_init(){}'
Hello world!

@ckreibich - thoughts? Bringing back BRO_PLUGIN_BASE could work, but its usage seems brittle (as this ticket proofs).

I don't know. Chatting with @bbannier and @J-Gras this is pretty messy. Given there have been no complaints so far, I wonder if we can do some more drastic changes rather than trying to fix anything up.

@awelzel awelzel self-assigned this Jun 26, 2024
awelzel added a commit that referenced this issue Jun 26, 2024
Support for BRO_PLUGIN_BASE has been removed, resulting in the
ZeekPluginDynamic.cmake code to pick-up ${CMAKE_CURRENT_SOURCE_DIR}/scripts
as the plugin's script. For the package-template's generated skeleton,
these are however the extra scripts usually installed via zkg.

Propose creation of another CMakeLists.txt within plugin/ to prevent
this.

The main wart here is that zeek-plugin-create-package.sh contains assumption
about the location of additional DIST_FILES (../ relative to the build directory),
so we copy these at configure time into build/ to fix this.

I'm liking this more than re-introducing support for BRO_PLUGIN_BASE,
but not sure it's overly great.

Closes #35
@awelzel awelzel linked a pull request Jun 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant