Skip to content

Conversation

@OneBlue
Copy link
Collaborator

@OneBlue OneBlue commented Jan 31, 2026

Summary of the Pull Request

This change updates the init protocol to correctly handle empty strings in array.

This change also test coverage for empty arguments at the VM, container and exec level

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings January 31, 2026 01:10
@OneBlue OneBlue requested a review from a team as a code owner January 31, 2026 01:10
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 the handling of empty string arguments when creating processes in WSL by updating the init protocol. Previously, the protocol couldn't distinguish between empty strings and the end of the array because it used null-terminated strings. The new protocol uses length-prefixed strings with an int32_t size prefix for each string and a -1 terminator for the array.

Changes:

  • Updated string array serialization to use length-prefixed format instead of null-terminated format
  • Updated string array deserialization to handle the new format and return vector<string> instead of vector<const char*>
  • Added comprehensive test coverage for empty arguments at VM, container, and exec levels

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/shared/inc/message.h Updated WriteStringArray to serialize strings with int32_t length prefix and -1 terminator
src/shared/inc/stringshared.h Updated ArrayFromSpan to deserialize length-prefixed strings into vector<string>; added StringPointersFromArray helper
src/shared/inc/prettyprintshared.h Updated pretty printing to use new ArrayFromSpan API and added MessageSize field to StringArray struct
src/linux/init/WSLAInit.cpp Updated to use StringPointersFromArray to convert string vectors to char pointer arrays for execve
test/windows/WSLATests.cpp Added tests validating empty argument handling for VM processes, container init processes, and exec'd processes

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.

2 participants