CFE-3866: Add workaround for set_variable_values_ini errors when section doesn't exist#3128
Merged
nickanderson merged 2 commits intocfengine:masterfrom Apr 16, 2026
Merged
Conversation
d11c06d to
0cbcc42
Compare
Member
Author
|
Together with cfengine/core#6072 |
Member
Author
|
@cf-bottom jenkins please |
|
Alright, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13533/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13533/ |
a64d34b to
f95d2fe
Compare
Member
Author
|
@cf-bottom jenkins please |
|
Alright, I triggered a build: Jenkins: https://ci.cfengine.com/job/pr-pipeline/13534/ Packages: http://buildcache.cfengine.com/packages/testing-pr/jenkins-pr-pipeline-13534/ |
larsewi
approved these changes
Apr 16, 2026
craigcomstock
approved these changes
Apr 16, 2026
Modified set_variable_values_ini() to check if the section exists before attempting to use select_region. When the section doesn't exist yet, lines are inserted after the section header instead of using select_region. This prevents 'could not select an edit region' errors when the section is being created by the same bundle in an earlier promise. The fix: - Detects if section exists using regline() - For existing sections: uses select_region (original behavior) - For new sections: inserts after section header using location => after() - Adds unique handles to distinguish the two insertion paths Ticket: CFE-3866 Changelog: Title
This test demonstrates the bug where set_variable_values_ini() emits 'could not select an edit region' errors when called on a file where the promised section doesn't exist yet. The test creates an empty file and uses set_variable_values_ini() to add sections with keys. Without the fix in the previous commit, this produces multiple errors even though the sections are created by the same bundle. Ticket: CFE-3866 Changelog: None
aea18af to
39d13f6
Compare
craigcomstock
approved these changes
Apr 16, 2026
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.
This test demonstrates the bug where set_variable_values_ini() emits
'could not select an edit region' errors when called on a file where
the promised section doesn't exist yet.
The test creates an empty file and uses set_variable_values_ini() to
add a section with keys. Without the fix, this produces multiple errors
even though the section is created by the same bundle.
Together with cfengine/core#6072
Ticket: CFE-3866