Repository navigation
Conversation
Signed-off-by: Victor Moene <victor.moene@northern.tech>
GetProcessStat() asserted on unexpected open() errors, e.g. when the process exited in the meantime. Release builds would loop forever instead. Now logs the error and returns false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ticket: CFE-4285 Changelog: Title Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
CFE-4285: Fixed cf-agent assertion failure when reading /proc/<pid>/stat
…ions.c Linked TODOs to new tickets to fix old bugs/TODOs that were already in cf-agent before moving the code. Signed-off-by: Victor Moene <victor.moene@northern.tech>
Better concurrency for cf-reactor static state - No need for map anymore, since watcher keeps track of the promise - No need to keep key as variable anymore, since we do not use a map - No need to run bundle inside watcher.c - No risk of running a bundle from a wrong key between policy reads Signed-off-by: Victor Moene <victor.moene@northern.tech>
Promises are skipped to prevent running them several times. However, on event, we want to run them every single time: - we clear the promise lock cache - we set the default if_elapsed time for bundles run from an events promise to be 0, so it doesn't skip the promises. Fixed also connection cache and custom promise prologue and epilogue. Clear function cache before "then" bundle run Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
- Moved mod_methods.c's MethodsParseTreeCheck implementation to PromiseCheckBundleCallArity in policy.c, and made it more generic - Now, MethodsParseTreeCheck and EventsParseTreeCheck both call this new function when calling bundles Signed-off-by: Victor Moene <victor.moene@northern.tech>
ENT-14194: Run policy on event
DiffPkgOperations() and ManifestPkgOperations() keyed their maps on "<name>-_-<architecture>", so the records of two different packages could share a key (name "a-_-b" with architecture "c" and name "a" with architecture "b-_-c") and one package's operation could replace or cancel the other's. The key now prefixes the name with its length, which makes it unique for every pair of name and architecture. Ticket: none Changelog: Title Signed-off-by: Daniel JB Clark <djbclark@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.


Fork-internal PR for CI; not an upstream submission. One commit: the diff and manifest reports of
--simulatekeep per-package maps keyed on<name>-_-<architecture>. That key is not unique: namea-_-bwith architecturecand nameawith architectureb-_-cshare it, so one package's record could replace or cancel the other's and a real install or removal went missing from the report. The key now prefixes the name with its length (<len>:<name>:<architecture>), which decodes to exactly one pair. Nothing parses the key back; the printed messages come from the records, not the key. Two unit tests cover it; both fail on the unfixed code. Found by the adversary review of #41 (finding 2). Adversary security review of this commit: no findings.ELI5 — auditable without C
You know shell and a little Python. One fact.
What the code is for.
cf-agent --simulatedoesn't install or remove packages. It writes one CSV line per package action it would take,op,name,version,architecture, and at the end turns that log into a report, folding the lines about the same package (same name and architecture) into one message.The fact. "Same package" was decided by gluing name and architecture together with
-_-:With the length in front there is only one way to cut the key back into a name and an architecture, whatever characters they contain. Names and architectures come from the package module, so the old key could make a removal of one package disappear when another, unrelated package was installed in the same run.
How you'd catch me lying, without reading C.
tests/unit/simulate_mode_testfeedsr,a-_-b,,ctheni,a,,b-_-cand checks the diff report says bothPackage 'a-_-b-c' would be removedandPackage 'a-b-_-c' would be installed; a second test checks the manifest report saysabsentandpresentfor the two. On the unfixed code the removal line is missing in both (the install cancelled it); on the fixed code all four tests pass. Both runs were done with the library rebuilt in between.🤖 Generated with Claude Code