Skip to content

Commit 8a11062

Browse files
Darleletcapflam
authored andcommitted
BUG/MINOR: log: fix broken '+bin' logformat node option
In 12d08cf ("BUG/MEDIUM: log: don't ignore disabled node's options"), while trying to restore historical node option inheritance behavior, I broke the '+bin' logformat node option recently introduced in b7c3d8c ("MINOR: log: add +bin logformat node option"). Indeed, because of 12d08cf, LOG_OPT_BIN is not set anymore on individual nodes even if it was set globally, making the feature unusable. ('+bin' is also used for binary cbor encoding) What I should have done instead is include LOG_OPT_BIN in the options inherited from global ones. This is what's being done in this commit. Misleading comment was adjusted. It must be backported in 3.0 with 12d08cf. (cherry picked from commit 0030f72) Signed-off-by: Christopher Faulet <[email protected]>
1 parent a45a8e6 commit 8a11062

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/log.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -930,14 +930,17 @@ static int lf_expr_postcheck_node_opt(struct lf_expr *lf_expr, struct logformat_
930930
* Also, ensure we don't mix encoding types, global setting
931931
* prevails over per-node one.
932932
*
933-
* Finally, ignore LOG_OPT_BIN since it is a global-only option
933+
* Finally, only consider LOG_OPT_BIN if set globally
934+
* (it is a global-only option)
934935
*/
935936
if (lf_expr->nodes.options & LOG_OPT_ENCODE) {
936937
node->options &= ~(LOG_OPT_BIN | LOG_OPT_ENCODE);
937-
node->options |= (lf_expr->nodes.options & LOG_OPT_ENCODE);
938+
node->options |= (lf_expr->nodes.options & (LOG_OPT_BIN | LOG_OPT_ENCODE));
938939
}
939-
else
940+
else {
940941
node->options &= ~LOG_OPT_BIN;
942+
node->options |= (lf_expr->nodes.options & LOG_OPT_BIN);
943+
}
941944

942945
_lf_expr_postcheck_node_opt(&node->options, lf_expr->nodes.options);
943946

0 commit comments

Comments
 (0)