Skip to content

Scripts break if /etc/wsl.conf has 'root' #200

Closed
@IsaacOscar

Description

The following line here is problematic:

tmp="$(awk -F '=' '/root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}')"

It causes all the wsl utilities to break when /etc/wsl.conf has the word root in places other than the name of a property:

For example:

[automount]
root = /

[user]
default = root

Causes the interop_prefix to be set /\nroot which is clearly invalid.

Here is a simple fix (I don't know awk so there's probably a better one):

grep '^\s*root\s*=' /etc/wsl.conf | awk -F '=' '/root/ {print $2}' | awk '{$1=$1;print}'

Metadata

Assignees

No one assigned

    Labels

    BugThis is either an issue that describes a bug or a PR that resolves a bugStatus: Pending ReleaseThis is fixed but not yet released.Target: 3.xThis is targeted to the 3.x version.Target: 4.xThis is targeted to the 4.x release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions