Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
IsaacOscar opened this issue Aug 19, 2021 · 2 comments · Fixed by #213
Closed

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

IsaacOscar opened this issue Aug 19, 2021 · 2 comments · Fixed by #213
Labels
Bug This is either an issue that describes a bug or a PR that resolves a bug Status: Pending Release This is fixed but not yet released. Target: 3.x This is targeted to the 3.x version. Target: 4.x This is targeted to the 4.x release.

Comments

@IsaacOscar
Copy link
Contributor

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}'
@lucyllewy
Copy link
Contributor

Maybe a more robust ini parser can help, e.g. https://github.com/albfan/bash-ini-parser

@patrick330602
Copy link
Member

Thank you for this information. I will fix this as soon as possible.

@patrick330602 patrick330602 added Bug This is either an issue that describes a bug or a PR that resolves a bug Status: In Progress This is being worked on and not ready. Target: 3.x This is targeted to the 3.x version. Target: 4.x This is targeted to the 4.x release. labels Sep 12, 2021
@patrick330602 patrick330602 added Status: Pending Release This is fixed but not yet released. and removed Status: In Progress This is being worked on and not ready. labels Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is either an issue that describes a bug or a PR that resolves a bug Status: Pending Release This is fixed but not yet released. Target: 3.x This is targeted to the 3.x version. Target: 4.x This is targeted to the 4.x release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants