Space in username breaks wsl integration cache

Bug #1869878 reported by Wes Garland
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
wslu (Ubuntu)
Fix Released
Critical
Patrick Wu

Bug Description

* What you're doing and what's happening: launching bash from a user whose name includes a space breaks /etc/profile.d/wsl-integration.sh

* What's wrong / what should be happening instead:

> PS C:\Users\Jack Troughton\git\dcp-jason> bash
> -bash: [: /mnt/c/Users/Jack: binary operator expected
> mkdir: cannot create directory ë/mnt/c/Users/Jackí: Permission denied
> -bash: $WSL_INTEGRATION_CACHE: ambiguous redirect
>
>

The reason it breaks is due to incorrect quoting around $HOME and things derived from it. It looks like you have parallel issues as well which could break pulse audio on a machine with a space in its hostname (is that legal in windows-land?)

I have created a zip file containing a fix, both the complete script and a unified context diff. I hereby place my changes in the public domain, free for use by anybody for anything.

The fix is at http://people.kingsds.network/wesgarland/wsl-integration-fix.zip

Windows build number: Microsoft Windows [Version 10.0.18362.720]

My WSL is the Ubuntu flavour of
Linux version 4.4.0-18362-Microsoft (<email address hidden>) (gcc version 5.4.0 (GCC) ) #476-Microsoft Fri Nov 01 16:53:00 PST 2019

lsb_release -rd says
Description: Ubuntu 18.04.4 LTS
Release: 18.04

apt-cache policy wslu says
wslu:
  Installed: (none)
  Candidate: 2.3.2-0ubuntu2~18.04.3
  Version table:
     2.3.2-0ubuntu2~18.04.3 500
        500 http://ca.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://ca.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages

Related branches

Balint Reczey (rbalint)
tags: added: regression-update
Balint Reczey (rbalint)
Changed in wslu (Ubuntu):
status: New → Confirmed
importance: Undecided → Critical
Patrick Wu (callmepk)
Changed in wslu (Ubuntu):
status: Confirmed → In Progress
Patrick Wu (callmepk)
Changed in wslu (Ubuntu):
assignee: nobody → Patrick Wu (callmepk)
Patrick Wu (callmepk)
Changed in wslu (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package wslu - 2.3.6-0ubuntu1

---------------
wslu (2.3.6-0ubuntu1) focal; urgency=medium

  [ Patrick Wu ]
  * Upstream update to 2.3.6 to address critical issues (LP: #1871986)
    - wslupath manpage update
    - fixes that imported distro cannot be properly handled by baseexec_gen
    - fix an issue in handling dirty output in regenerate baseexec
    - fix an issue in generating ~/.config/baseexec
    - wslusc: fix an issue that will cause generated shortcut cannot be opened
      for some users
  * Update patches
  * debian/wsl-integration.sh: removal links in profile.d as requested by MSFT.
  * debian/wsl-integration.sh: Fix issue that space in username breaks
    wsl-integration.sh. (LP: #1869878)
  * debian/wsl-integration.sh: Use /tmp folder for system users who do not have
    $HOME. (LP: #1859509)

  [ Balint Reczey ]
  * debian/wsl-integration.sh: Suppress errors when saving $HOME/.cache.
    (LP: #1859509)
  * debian/wsl-integration.sh: debian/wsl-integration.sh unset the right
    variable at the end of script. (LP: #1857426)

 -- Patrick Wu <email address hidden> Thu, 09 Apr 2020 20:27:13 +0800

Changed in wslu (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.