Skip to content

WSL configuation files are not following standard TOML for string values #13847

@HubertMajewski

Description

@HubertMajewski

Windows Version

10.0.26200.7171

WSL Version

2.6.1.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.6.87.2

Distro Version

6.6.87.2-microsoft-standard-WSL2

Other Software

Any available TOML CLI parser such as
a. https://github.com/blinxen/tomli
b. https://github.com/gnprice/toml-cli

Repro Steps

  1. Follow a setup of wsl.conf on https://learn.microsoft.com/en-us/windows/wsl/wsl-config
    a. Example wsl.conf:
[user]
default=user
  1. Install a TOML parser like tomli, or toml-cli.
    a. sudo apt-get install cargo
    b. sudo cargo install tomli OR sudo cargo install toml-cli

  2. Try to read/write with TOML parser /etc/wsl.conf with illegal strings.
    a. sudo toml get /etc/wsl.conf user.default
    OR
    b. sudo tomli set -if /etc/wsl.conf user.default user

See error regarding the TOML requirement for a string value to be quoted. Such as:

toml: TOML parse error at line 2, column 9
  |
2 | default=user
  |         ^
Unexpected `u`
Expected quoted string

OR

The provided TOML document has an invalid syntax:

TOML parse error at line 2, column 9
  |
2 | default=user
  |         ^^^^
string values must be quoted, expected literal string

Expected Behavior

I have expected the WSL config files to follow an up-to-date specification for TOML such that command line tools may be used for key lookups or writes; strings must be required to be quoted as defined here: https://toml.io/en/v1.0.0#string

Actual Behavior

The actual behavior can be split in two parts:
a. Both /etc/wsl.conf and %USERPROFILE%/.wslconfig may allow for unquoted strings.
b. The Microsoft provided documentation (https://learn.microsoft.com/en-us/windows/wsl/wsl-config) contains multiple examples of strings that are not quoted.

Diagnostic Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions