WSL paths need further escape of single quotes #22357

Open
opened 2026-01-31 08:10:48 +00:00 by claunia · 0 comments
Owner

Originally created by @a4lg on GitHub (Oct 8, 2024).

Windows Terminal version

1.20.11781.0

Windows build number

10.0.26100.0

Other Software

Ubuntu 24.04 (in WSL and source of Windows.Terminal.Wsl in the profile; any WSL distributions are affected)

Steps to reproduce

  1. Open a WSL tab.
  2. Drag and drop a file/folder (the full path needs at least one single quote ' character), say D:\John's Archive.

Expected Behavior

When

D:\John's Archive

is dropped to a WSL tab, a string which expands to:

/mnt/d/John's Archive

(single argument) in the shell should be dropped.

An example satisfying this condition includes '/mnt/d/John'"'"'s Archive' (escaping a single quote ' with '"'"' (finish quote, print a single quote character then begin quote again).

Note: the expected behavior may differ depending on which environment we should assume.
This expected behavior here is of the POSIX shell context and I think this is reasonable.

Actual Behavior

In the dropped path, single quotes in the original full path are kept as-is (D:\John's Archive'/mnt/d/John's Archive').

This is clearly wrong in the POSIX shell context because a quoted string ends before s and the space after s is not quoted and will not be preserved.

Originally created by @a4lg on GitHub (Oct 8, 2024). ### Windows Terminal version 1.20.11781.0 ### Windows build number 10.0.26100.0 ### Other Software Ubuntu 24.04 (in WSL and `source` of `Windows.Terminal.Wsl` in the profile; any WSL distributions are affected) ### Steps to reproduce 1. Open a WSL tab. 2. Drag and drop a file/folder (the full path needs at least one single quote `'` character), say `D:\John's Archive`. ### Expected Behavior When ``` D:\John's Archive ``` is dropped to a WSL tab, a string which expands to: ``` /mnt/d/John's Archive ``` (single argument) in the shell should be dropped. An example satisfying this condition includes `'/mnt/d/John'"'"'s Archive'` (escaping a single quote `'` with `'"'"'` (finish quote, print a single quote character then begin quote again). Note: the *expected* behavior may differ depending on which environment we should assume. *This expected behavior here* is of the POSIX shell context and I think this is reasonable. ### Actual Behavior In the dropped path, single quotes in the original full path are kept as-is (`D:\John's Archive` → `'/mnt/d/John's Archive'`). This is clearly wrong in the POSIX shell context because a quoted string ends before `s` and the space after `s` is not quoted and will not be preserved.
claunia added the Issue-BugIn-PRNeeds-Tag-FixProduct-TerminalArea-TerminalControl labels 2026-01-31 08:10:48 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22357