You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Empty UnparseableSections is not marked as rawBody #291
Describe the bug
When loading an ini with multiple sections with the last section as "UnparsableSection" and this last section is empty then the Section is not marked as rawBody and therefore can not be used to write raw data to.
It works well when at least one line of data is in the section.
I’ll work on a focused fix in this session, with regression tests for empty unparseable sections at EOF and before a following section. The raw-section flag should be established when the section header is read, so SetBody works even when there is no body line.
I’m checking whether this still reproduces on current main and preparing a small regression for empty sections at EOF and before another section. I found no open or closed PR for #291; please flag any overlapping work.
Fixed in v2 by #435, and will be in the next v2 pre-release after v2.0.0-beta.2. v2 is imported as unknwon.dev/ini/v2; see the migration guide for upgrading from v1.
In v2, UnparseableSections is renamed to the RawSections option.
Activity
frankkopp commentedon Jun 4, 2021
Here is the piece in your code were it goes wrong:

The line 481: section.isRawSection = true is only executed after reading the the next line. If the file is at it's end it will never be set.
Maybe move this line as per my suggestion in the screenshot?
vzer200 commentedon Sep 8, 2026
I’ll work on a focused fix in this session, with regression tests for empty unparseable sections at EOF and before a following section. The raw-section flag should be established when the section header is read, so
SetBodyworks even when there is no body line.yuefdev commentedon Oct 18, 2026
I’m checking whether this still reproduces on current main and preparing a small regression for empty sections at EOF and before another section. I found no open or closed PR for #291; please flag any overlapping work.
unknwon commentedon Nov 11, 2026
Fixed in v2 by #435, and will be in the next v2 pre-release after v2.0.0-beta.2. v2 is imported as
unknwon.dev/ini/v2; see the migration guide for upgrading from v1.In v2,
UnparseableSectionsis renamed to theRawSectionsoption.