mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00

Scripting errors/mistakes now consistently generate a runtime error which have the behavior of unwinding the call stack all the way out of the current event handler. Before, such errors were not treated consistently and either aborted the process entirely or emitted a message while continuing to execute subsequent statements without well-defined behavior (possibly causing a cascade of errors). The previous behavior also would only unwind out of the current function (if within a function body), not out the current event handler, which is especially problematic for functions that return a value: the caller is essentially left a mess with no way to deal with it. This also changes the behavior of the startup/initialization process to abort if there's errors during bro_init() rather than continue one to the main run loop. The `allow_init_errors` option may change this new, default behavior.
69 lines
1.8 KiB
Bash
Executable file
69 lines
1.8 KiB
Bash
Executable file
#! /usr/bin/env bash
|
|
|
|
unset BRO_DISABLE_BROXYGEN
|
|
|
|
# If running this from btest, unset any of the environment
|
|
# variables that alter default script values.
|
|
unset BRO_DEFAULT_LISTEN_ADDRESS
|
|
unset BRO_DEFAULT_LISTEN_RETRY
|
|
unset BRO_DEFAULT_CONNECT_RETRY
|
|
|
|
dir="$( cd "$( dirname "$0" )" && pwd )"
|
|
source_dir="$( cd $dir/../.. && pwd )"
|
|
build_dir=$source_dir/build
|
|
conf_file=$build_dir/broxygen-test.conf
|
|
output_dir=$source_dir/doc
|
|
bro_error_file=$build_dir/broxygen-test-stderr.txt
|
|
|
|
if [ -n "$1" ]; then
|
|
output_dir=$1
|
|
fi
|
|
|
|
case $output_dir in
|
|
/*) ;;
|
|
*) output_dir=`pwd`/$output_dir ;;
|
|
esac
|
|
|
|
cd $build_dir
|
|
. bro-path-dev.sh
|
|
export BRO_SEED_FILE=$source_dir/testing/btest/random.seed
|
|
|
|
function run_bro
|
|
{
|
|
ZEEK_ALLOW_INIT_ERRORS=1 bro -X $conf_file broxygen >/dev/null 2>$bro_error_file
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "Failed running bro with broxygen config file $conf_file"
|
|
echo "See stderr in $bro_error_file"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
scripts_output_dir=$output_dir/scripts
|
|
rm -rf $scripts_output_dir
|
|
printf "script\t*\t$scripts_output_dir/" > $conf_file
|
|
echo "Generating $scripts_output_dir/"
|
|
run_bro
|
|
|
|
script_ref_dir=$output_dir/script-reference
|
|
mkdir -p $script_ref_dir
|
|
|
|
function generate_index
|
|
{
|
|
echo "Generating $script_ref_dir/$2"
|
|
printf "$1\t*\t$script_ref_dir/$2\n" > $conf_file
|
|
run_bro
|
|
}
|
|
|
|
generate_index "script_index" "autogenerated-script-index.rst"
|
|
generate_index "package_index" "autogenerated-package-index.rst"
|
|
generate_index "file_analyzer" "autogenerated-file-analyzer-index.rst"
|
|
generate_index "proto_analyzer" "autogenerated-protocol-analyzer-index.rst"
|
|
|
|
echo
|
|
|
|
if [ -n "$(cd $source_dir/doc && git status --porcelain)" ]; then
|
|
echo "*** There are changes in zeek-docs that need a review, commit, and push ***"
|
|
else
|
|
echo "No changes or further action needed"
|
|
fi
|