Skip to content

CFE-3105: Made format collect data container#6223

Draft
victormlg wants to merge 4 commits into
cfengine:masterfrom
victormlg:make_format_collecting
Draft

CFE-3105: Made format collect data container#6223
victormlg wants to merge 4 commits into
cfengine:masterfrom
victormlg:make_format_collecting

Conversation

@victormlg

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread libpromises/evalfunction.c Fixed
Comment thread libpromises/evalfunction.c Fixed
@victormlg victormlg force-pushed the make_format_collecting branch from bf0432b to 9667796 Compare July 9, 2026 10:31
{
Writer *w = StringWriter();
JsonWriteCompact(w, (JsonElement*) data->val.item);
BufferAppendF(buf, format_rewrite, StringWriterData(w));
@victormlg victormlg force-pushed the make_format_collecting branch 6 times, most recently from 4cbd7be to 17788db Compare July 10, 2026 09:52
nickanderson and others added 4 commits July 10, 2026 12:51
An insert_lines promise using select_region with select_end_match_eof
cannot select the region of the final section when that section header
is the last line of the file. The region is empty and sits at the end
of the file, SelectRegion() rejects it, and the insertion fails with
"could not select an edit region".

This test fails today and will pass once SelectRegion() honors
select_end_match_eof for an empty region at end of file.

Ticket: CFE-2663
Changelog: None
Signed-off-by: Nick Anderson <nick@cmdln.org>
The read loop never touched the output buffer when the command
produced no output: it hit EOF on the first iteration and returned
success, leaving the buffer exactly as the caller allocated it. A
caller using malloc() then saw stale heap data as command output —
this made cf-agent's container inventory intermittently treat a freed
'docker image inspect' JSON buffer as the 'docker volume ls --quiet'
result on Windows.

NUL-terminate the buffer up front so callers always get a valid,
possibly empty, string.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Ticket: CFE-3105
Changelog: Title
Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg victormlg force-pushed the make_format_collecting branch from 17788db to 3a40ef1 Compare July 10, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants