Skip to content

wsl.conf: line continuation is broken when the file uses CRLF line endings #41590

Closed

Description

Windows Version

Not tied to a Windows version (found in the source, master at eaa69e7)

WSL Version

master at eaa69e7

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

No response

Other Software

No response

Repro Steps

I noticed this while reading src/shared/configfile/configfile.cpp. Inside a value, an escaped \r is meant to be skipped as part of a CRLF line continuation, but only the \r is consumed. The \n that follows is read back by the value loop, which ends the value there.

Put this in /etc/wsl.conf with CRLF line endings (for example after editing it from Windows):

[boot]
command=echo a \
 b
[network]
hostname=foo

then restart the distribution.

Expected Behavior

Same result as with LF line endings: boot.command is echo a b and the hostname is foo.

Actual Behavior

boot.command is cut to echo a , the line b is parsed as a key with no =, and because the guest parses wsl.conf without CFG_SKIP_INVALID_LINES, parsing stops at that point. Everything after the continuation (here [network] hostname) is silently ignored.

I have not run this on a live WSL install. I compiled configfile.cpp on its own on Linux against the same content and got:

LF   result=0 command='echo a  b' hostname='foo'
CRLF result=-1 command='echo a ' hostname=''

Diagnostic Logs

No response

Activity

  1. github-actions commented on Sep 12, 2026

    @github-actions
    Contributor

    Logs are required for review from WSL team

    If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
    Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

    How to collect WSL logs

    Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

    Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\collect-wsl-logs.ps1
    

    The script will output the path of the log file once done.

    If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

    Once completed please upload the output files to this GitHub issue.

    See Collect WSL logs (recommended method).

    If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-investigationlikely actionable and/or needs more investigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions