Skip to content

Conversation

@benhillis
Copy link
Member

This change resolves an issue with writing the .wslconfig file where entries may be written without the correct header preceding them, causing the setting to fail to parse.

Resolves #12671

Copilot AI review requested due to automatic review settings December 13, 2025 20:51
@benhillis benhillis requested a review from a team as a code owner December 13, 2025 20:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in the WSL configuration file parser where key-value pairs could be written before their section headers, causing "Unknown key" errors when parsing .wslconfig files. The fix moves the key-value writing logic to trigger immediately when a new section header is encountered, ensuring proper INI file structure is maintained.

  • Relocated key-value insertion logic from after section parsing to before encountering new section headers
  • Added comprehensive test coverage with 6 regression tests covering edge cases like empty sections, duplicate sections, and EOF scenarios
  • Updated developer documentation to emphasize the need for full builds before running tests

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/shared/configfile/configfile.cpp Moved key-value writing logic from ParseSection label to before case '[' to ensure keys are written to their current section before transitioning to a new section; removed unused newKeyValueInsertPos variable
test/windows/UnitTests.cpp Added 6 comprehensive regression tests for issue #12671 covering the bug scenario, empty files, multiple same-section instances, EOF without trailing newline, empty sections, and section headers at EOF
.github/copilot-instructions.md Added critical warning about requiring full project builds before running tests, with explanation of component dependencies

@benhillis benhillis merged commit 180d811 into master Dec 15, 2025
6 checks passed
benhillis added a commit that referenced this pull request Dec 20, 2025
* cleanup: minor tweaks to path translation failed messages (#13892)

Co-authored-by: Ben Hillis <[email protected]>

* Localization change from build: 135812430 (#13905)

* Localization change from build: 135812430

* Apply suggestions from code review

Co-authored-by: Copilot <[email protected]>

* remove unused string

---------

Co-authored-by: WSL localization <[email protected]>
Co-authored-by: Ben Hillis <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Ben Hillis <[email protected]>

* Resolve issue with config file writing sections outside of their expected header. (#13898)

* Resolve issue with config file writing sections outside of their expected header.

* add more writewslconfig variations

* formatting

---------

Co-authored-by: Ben Hillis <[email protected]>

* Resolve issue with buttons on notifications not working correctly (#13921)

* Resolve issue with buttons on notifications not working correctly

* pr feedback

---------

Co-authored-by: Ben Hillis <[email protected]>

* Fix minor typo in UserConfig.cmake.sample (.exe instead of .dll) (#13926)

Co-authored-by: Ben Hillis <[email protected]>

* test: extend networking test coverage (#13914)

* test: extend coverage of virtioproxy networking mode

* test: add dns test variations to all networking classes

* remove bridged dns variations

* pr feedback

---------

Co-authored-by: Ben Hillis <[email protected]>

* cleanup: remove duplicate AppId registration for wsldevicehost.dll (#13928)

Co-authored-by: Ben Hillis <[email protected]>

* Remove the explicit desktop field when creating a Windows process (#13930)

* [GH 13837] Remove trailing slash from $XDG_RUNTIME_DIR (#13929)

* [GH 13837] Remove trailing slash from $XDG_RUNTIME_DIR

* pr feedback

---------

Co-authored-by: Ben Hillis <[email protected]>

* test: add more path translation variations (#13927)

* test: add more path translation variations

* Update test/windows/SimpleTests.cpp

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Ben Hillis <[email protected]>

* virtiofs: enable additional test cases and skip one racey test (#13933)

Co-authored-by: Ben Hillis <[email protected]>

* cleanup: add scsi disks during VM creation (#13939)

* cleanup: add scsi disks during VM creation

* pr feedback

---------

Co-authored-by: Ben Hillis <[email protected]>

* cleanup: hcs logging improvements (#13942)

Co-authored-by: Ben Hillis <[email protected]>

* cleanup: switch drvfs.cpp to use common MountUtil helper (#13890)

* cleanup: switch drvfs.cpp to use common MountUtil helper

* adjust mount.drvfs error logging

* adjust mount.drvfs error logging

---------

Co-authored-by: Ben Hillis <[email protected]>

---------

Co-authored-by: Ben Hillis <[email protected]>
Co-authored-by: Blue <[email protected]>
Co-authored-by: WSL localization <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WSL App puts memory size on line above [wsl2] in .wslconfig

3 participants