Bashism in snapd.sh (aka apps-in-path.sh) breaks dash

Bug #1925810 reported by Alvin Seville
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Released
Undecided
Unassigned
snapd (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

WSL version: 2
Kernel version: Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC))
Ubuntu version: 20.04.2 LTS

Steps to reproduce issue:
- run chsh -s /bin/sh (/bin/sh points to dash on my system)
- open new Windows Terminal tab and obtain -sh: 6: export: Files/PowerShell/7:/mnt/c/tools/ruby30/bin:/mnt/c/Python39/Scripts/:/mnt/c/Python39/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program: bad variable name error

Steps to fix issue:
- replace 6-th line in /etc/profile.d/apps-bin-path.sh with export PATH="$PATH:${snap_bin_path}"

As I understood from @therealkenc response here https://github.com/microsoft/WSL/issues/6838#issuecomment-825161072 I have to fill this issue here.

Tags: wsl
description: updated
description: updated
summary: - dash shell is broken
+ Incorrect quote use in apps-bin-path.sh
tags: added: wsl
Zygmunt Krynicki (zyga)
summary: - Incorrect quote use in apps-bin-path.sh
+ Bashism in snapd.sh (aka apps-in-path.sh) breaks dash
Revision history for this message
Sebastien Bacher (seb128) wrote :

The issue as pointed on the github report is that the line is currently

    export PATH=$PATH:${snap_bin_path}

without quoting it seems to not deal correctly with space in directory names?

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

On a second look, this is fixed by ae84b651f464f297c046b60b82c60ecdd69ce80e - a patch from the 2nd of Feb 2021.

Revision history for this message
Alvin Seville (alvinseville7cf) wrote :

@seb128, yes.

Revision history for this message
Ian Johnson (anonymouse67) wrote :

This will be fixed in 2.50

Changed in snapd:
status: New → Fix Committed
Changed in snapd (Ubuntu):
status: New → Fix Committed
Changed in snapd:
milestone: none → 2.51
status: Fix Committed → Fix Released
Changed in snapd (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.