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

wslu tools report errors when automount root is quoted in wsl.conf #247

Closed
mkielar opened this issue Oct 6, 2022 · 4 comments
Closed

wslu tools report errors when automount root is quoted in wsl.conf #247

mkielar opened this issue Oct 6, 2022 · 4 comments
Labels
Bug This is either an issue that describes a bug or a PR that resolves a bug Status: Patched This is fixed and is part of a released version. Target: 4.x This is targeted to the 4.x release.
Milestone

Comments

@mkielar
Copy link

mkielar commented Oct 6, 2022

Background Information:

  • Windows Version: Windows 11 Pro 21H2
  • Windows Build: 22000.1042
  • WSL: fedoraremix running on WSL1
  • Version: 36.0.5
  • Output from wsl --version:
    wsl --version
    WSL version: 0.66.2.0
    Kernel version: 5.15.57.1
    WSLg version: 1.0.42
    MSRDC version: 1.2.3401
    Direct3D version: 1.606.4
    DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows version: 10.0.22000.1042
    
  • Output from dnf info wslu:
    Installed Packages
    Name         : wslu
    Version      : 4.0.0
    Release      : 1
    Architecture : noarch
    Size         : 251 k
    Source       : wslu-4.0.0-1.src.rpm
    Repository   : @System
    From repo    : copr:copr.fedorainfracloud.org:wslutilities:wslu
    (truncated for brevity)
    

Describe the bug
When the root property contains a quoted value in /etc/wsl.conf, wslu tools show errors when ran, such as below:

→ wslupath --help
/usr/bin/wslupath: line 207: "/"/c/Windows/System32/reg.exe: No such file or directory
/usr/bin/wslupath: line 207: "/"/c/Windows/System32/reg.exe: No such file or directory
wslupath - Part of wslu, a collection of utilities for Linux Subsystem for Windows (WSL)
Usage: wslupath [-dOr] [-D|-A|-T|-S|-W|-s|-su|-H|-P|...NAME...]
wslupath [-h|-v|-R]

For more help for wslupath, please use the command `man wslupath` or visit the following site: https://wslutiliti.es/wslu/man/wslupath.html.
For overall help, you can use the command `man wslu` or visite the following site: https://wslutiliti.es/wslu.
→ wslact --help
/usr/bin/wslact: line 207: "/"/c/Windows/System32/reg.exe: No such file or directory
/usr/bin/wslact: line 207: "/"/c/Windows/System32/reg.exe: No such file or directory
wslact - Part of wslu, a collection of utilities for Linux Subsystem for Windows (WSL)
Usage: wslact COMMAND ...

For more help for wslact, please use the command `man wslact` or visit the following site: https://wslutiliti.es/wslu/man/wslact.html.
For overall help, you can use the command `man wslu` or visite the following site: https://wslutiliti.es/wslu.

To Reproduce
Steps to reproduce the behavior:

  1. Configure /etc/wsl.conf like this:
    [automount]
    root = "/"
    options = "metadata"
    
    Make sure the value of the root property is wrapped in " quotes.
  2. Run wslact --help
  3. Observe the No such file or directory warnings.

Expected behavior
wslu tools should understand quoted values in wsl.conf and act accordingly.

Additional context

  1. When changing the configuration in wsl.conf to root = / (unquoted), the issue disappears.
  2. Despite very simple workaround in pt.1 above, I still believe this is a bug in wslu implementation. If you refer to the wsl.conf documentation, it does not clearly define what the format of the file is, and what syntax should be used. It only shows examples on how to use specific configuration sections, and in these examples the root property is indeed presented as unquoted. However, the example also shows that the options property of the [automount] section can be quoted, and that - in my opinion - suggest that any value in the file can be quoted and it should be handled properly.
@patrick330602
Copy link
Member

Thank you for the report. I will fix the issue in 4.1.

@patrick330602 patrick330602 added Bug This is either an issue that describes a bug or a PR that resolves a bug Target: 4.x This is targeted to the 4.x release. labels Oct 6, 2022
@dj-rabel
Copy link

Hello @patrick330602. Not sure if opening a new issue would have been better, but the script failes as well, if one sets the default user to root in wsl.conf like so:

[user]
default = root

image

I was able to temporarily fix it for me, by changing the awk line inside the "interop_prefix" function to
tmp=$(awk -F '=' '/^\s*root/ {print $2}' /etc/wsl.conf | awk '{$1=$1;print}')

Hope this helps ♥

@2pl
Copy link

2pl commented Nov 21, 2022

Hi @patrick330602 I also noticed that the awk pattern for root does not ignore commented lines ie adding something like the below in /etc/wsl.conf will trigger similar errors as described above by @mkielar

# [automount]
# root = /whatever

I guess the modified awk interop_prefix function suggested by @dj-rabel should fix this as well.

@patrick330602 patrick330602 added this to the 4.1 milestone Dec 23, 2022
@patrick330602 patrick330602 added the Status: In Progress This is being worked on and not ready. label Dec 23, 2022
@patrick330602 patrick330602 reopened this Dec 24, 2022
@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 Dec 24, 2022
@patrick330602
Copy link
Member

fixed in dev

@patrick330602 patrick330602 moved this to To do in wslu Roadmap Dec 24, 2022
@patrick330602 patrick330602 moved this from To do to In progress in wslu Roadmap Dec 24, 2022
@patrick330602 patrick330602 moved this from In progress to Done in wslu Roadmap Dec 24, 2022
@patrick330602 patrick330602 added Status: Patched This is fixed and is part of a released version. and removed Status: Pending Release This is fixed but not yet released. labels Dec 27, 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: Patched This is fixed and is part of a released version. Target: 4.x This is targeted to the 4.x release.
Projects
Status: Done
Development

No branches or pull requests

4 participants