Fixed duplicate log_* entries from action bodies (CFE-85)#6232
Open
nickanderson wants to merge 1 commit into
Open
Fixed duplicate log_* entries from action bodies (CFE-85)#6232nickanderson wants to merge 1 commit into
nickanderson wants to merge 1 commit into
Conversation
7279d8a to
32e006c
Compare
| } | ||
|
|
||
| char key[CF_BUFSIZE]; | ||
| xsnprintf(key, sizeof(key), "%s:%s", PromiseID(pp), pp->promiser); |
A single promise could produce multiple identical entries in the log_kept, log_repaired, or log_failed files configured via an action body. This happened because DoSummarizeTransaction is called once per evaluation pass and once per sub-attribute check (e.g. create then perms), each writing to the log file independently. Fix by recording a composite key (PromiseID + expanded promiser) in a StringSet on the EvalContext the first time a promise is logged, and skipping subsequent calls for the same key. PromiseID alone would falsely suppress a parameterized bundle called with different arguments (same source line, different expanded promiser); the expanded promiser alone would suppress distinct promises in different bundles targeting the same path. The composite key handles both cases. The dedup is gated on at least one log_* target being configured, so promises without action bodies pay no cost. Ticket: CFE-85 Changelog: Title
32e006c to
1d1cd71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DoSummarizeTransactionproducing duplicate entries inlog_kept/log_repaired/log_failedfiles when a promise is evaluated multiple times per run (once per pass, once per sub-attribute check like create vs perms)PromiseIDin aStringSeton theEvalContext; subsequent calls for the same promise are skippedlog_*target being configured, so promises without action bodies pay zero costTest plan
test_log_action_dedupeineval_context_test.c: drivescfPS()twice for the same promise and asserts only one line is written; also verifies distinct promises (different bundle/file/line) targeting the same path are NOT suppressedcfe_85.cf: two promisers withcreate => "true"and an action body; asserts exactly 2 lines in the repaired log (one per promiser, no duplicates)Ticket: CFE-85