diff --git a/CHANGES b/CHANGES index 8d04e3c714..30d784b670 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,27 @@ +7.1.0-dev.339 | 2024-09-27 14:59:45 +0200 + + * zeek-setup: Support enabling debug streams through env variable (Arne Welzel, Corelight) + + For debugging btests, it can be convenient to enable debug streams + by setting an environment variable rather than editing zeek invocations + and adding -B selectively. + + Sample use case: + + $ export ZEEK_DEBUG_LOG_STREAMS=all + $ btest -d core/failing-test.zeek + $ less .tmp/core/failing-test/debug.log + + This change makes Zeek's -B option and ZEEK_DEBUG_LOG_STREAMS are additive. + + * Install `procps` in OpenSuse Leap images (Benjamin Bannier, Corelight) + + The tests `core.sigterm-regular` and `core.sigterm-stdin` rely on `ps` + to be present which is not the case anymore on OpenSuse Leap; install it + explicitly there. + + * Bump auxil/spicy to latest development snapshot (Benjamin Bannier, Corelight) + 7.1.0-dev.332 | 2024-09-23 10:59:51 -0700 * pop3: Remove unused headers (Arne Welzel, Corelight) diff --git a/VERSION b/VERSION index 5e2ecc49e5..5ad96076a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.1.0-dev.332 +7.1.0-dev.339 diff --git a/src/DebugLogger.h b/src/DebugLogger.h index d22373b3ae..a8df9cd977 100644 --- a/src/DebugLogger.h +++ b/src/DebugLogger.h @@ -85,6 +85,9 @@ public: bool IsEnabled(DebugStream stream) const { return streams[int(stream)].enabled; } + // Are any streams enabled? + bool HasEnabledStreams() const { return ! enabled_streams.empty(); } + void SetVerbose(bool arg_verbose) { verbose = arg_verbose; } bool IsVerbose() const { return verbose; } diff --git a/src/Options.cc b/src/Options.cc index c0c6ff3d4e..2d0bb632c0 100644 --- a/src/Options.cc +++ b/src/Options.cc @@ -170,7 +170,10 @@ void usage(const char* prog, int code) { "not set, will use first IPv4 address from /etc/resolv.conf"); fprintf(stderr, " $ZEEK_DEBUG_LOG_STDERR | Use stderr for debug logs generated via " - "the -B flag"); + "the -B flag\n"); + fprintf(stderr, + " $ZEEK_DEBUG_LOG_STREAMS | Enable debugging output for selected " + "streams (see the -B flag)"); fprintf(stderr, "\n"); diff --git a/src/zeek-setup.cc b/src/zeek-setup.cc index 8e39653b6d..3cf44a5b7f 100644 --- a/src/zeek-setup.cc +++ b/src/zeek-setup.cc @@ -556,9 +556,13 @@ SetupResult setup(int argc, char** argv, Options* zopts) { reporter->FatalError("-u incompatible with --no-unused-warnings"); #ifdef DEBUG - if ( options.debug_log_streams ) { + if ( options.debug_log_streams ) debug_logger.EnableStreams(options.debug_log_streams->data()); + if ( const auto* streams = getenv("ZEEK_DEBUG_LOG_STREAMS") ) + debug_logger.EnableStreams(streams); + + if ( debug_logger.HasEnabledStreams() ) { if ( getenv("ZEEK_DEBUG_LOG_STDERR") ) debug_logger.OpenDebugLog(nullptr); else