diff --git a/CHANGES b/CHANGES index 3ca85e1ca8..81725d3915 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,5 @@ -3.3.0-dev.621 | 2020-12-07 18:04:07 +0000 +3.3.0-dev.624 | 2020-12-07 18:17:34 +0000 * Switch test baselines to canonified baselines @@ -15,6 +15,13 @@ (Christian Kreibich, Corelight with tiny additions by Johanna Amann, Corelight) +3.3.0-dev.611 | 2020-12-07 09:42:37 -0800 + + * Fix misassociation of Zeekygen-style comments within function scopes (Jon Siwek, Corelight) + + All Zeekygen-style comments relate to entities at global scope, so those + found within functions are now ignored instead of misassociated. + 3.3.0-dev.609 | 2020-12-04 19:20:39 -0800 * Remove an extraneous Zeekygen-style comment (Jon Siwek, Corelight) diff --git a/VERSION b/VERSION index c754508a52..7af397e727 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.0-dev.621 +3.3.0-dev.624 diff --git a/auxil/zeekctl b/auxil/zeekctl index 78228b4a57..0abed02b22 160000 --- a/auxil/zeekctl +++ b/auxil/zeekctl @@ -1 +1 @@ -Subproject commit 78228b4a570a382517f9154087340e6638a51fbe +Subproject commit 0abed02b22f75d40d8c089fa1185681a6a9ee6d6 diff --git a/scripts/zeekygen/example.zeek b/scripts/zeekygen/example.zeek index 1fcdd8390b..228c2daed2 100644 --- a/scripts/zeekygen/example.zeek +++ b/scripts/zeekygen/example.zeek @@ -175,6 +175,11 @@ export { # documentation. So using ``##``-style comments is pointless here. function function_without_proto(tag: string): string { + # Zeekygen-style comments only apply to entities at global-scope so + # Zeekygen doesn't associate the following comments with anything. + ##! This comment should be ignored by Zeekygen. + ## This comment should be ignored by Zeekygen. + ##< This comment should be ignored by Zeekygen. return "blah"; } diff --git a/src/scan.l b/src/scan.l index e80ef7ed68..71e95240e9 100644 --- a/src/scan.l +++ b/src/scan.l @@ -149,19 +149,24 @@ ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+)) %% ##!.* { - zeek::detail::zeekygen_mgr->SummaryComment(::filename, yytext + 3); + if ( zeek::detail::current_scope() == zeek::detail::global_scope() ) + zeek::detail::zeekygen_mgr->SummaryComment(::filename, yytext + 3); } ##<.* { - std::string hint(cur_enum_type && last_id_tok ? - zeek::detail::make_full_var_name(zeek::detail::current_module.c_str(), last_id_tok) : ""); + if ( zeek::detail::current_scope() == zeek::detail::global_scope() ) + { + std::string hint(cur_enum_type && last_id_tok ? + zeek::detail::make_full_var_name(zeek::detail::current_module.c_str(), last_id_tok) : ""); - zeek::detail::zeekygen_mgr->PostComment(yytext + 3, hint); + zeek::detail::zeekygen_mgr->PostComment(yytext + 3, hint); + } } ##.* { - if ( yytext[2] != '#' ) - zeek::detail::zeekygen_mgr->PreComment(yytext + 2); + if ( zeek::detail::current_scope() == zeek::detail::global_scope() ) + if ( yytext[2] != '#' ) + zeek::detail::zeekygen_mgr->PreComment(yytext + 2); } #{OWS}@no-test.* return TOK_NO_TEST; diff --git a/testing/external/commit-hash.zeek-testing b/testing/external/commit-hash.zeek-testing index 8d85059686..9ae966bb93 100644 --- a/testing/external/commit-hash.zeek-testing +++ b/testing/external/commit-hash.zeek-testing @@ -1 +1 @@ -ee7a02664fa8bf7eeaef4cc4bfdb7dbe70d9b5d9 +3cf13a8fa49d27c4430af8715aeaa10aef4e9c60 diff --git a/testing/external/commit-hash.zeek-testing-private b/testing/external/commit-hash.zeek-testing-private index 2a25afd84c..6a09fe8c97 100644 --- a/testing/external/commit-hash.zeek-testing-private +++ b/testing/external/commit-hash.zeek-testing-private @@ -1 +1 @@ -7cb3aa9635958a0e7757f45b2ce0898f7e76f481 +60127d523bc45e9ad57e649abfd0f6474627393f