-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
WSL paths need further escape of single quotes #18006
Labels
Area-TerminalControl
Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
In-PR
This issue has a related PR
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Needs-Tag-Fix
Doesn't match tag requirements
Product-Terminal
The new Windows Terminal.
Milestone
Comments
a4lg
added
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
labels
Oct 8, 2024
4 tasks
carlos-zamora
added
Product-Terminal
The new Windows Terminal.
and removed
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
labels
Oct 9, 2024
carlos-zamora
added
the
Area-TerminalControl
Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
label
Oct 9, 2024
a4lg
added a commit
to a4lg/terminal
that referenced
this issue
Nov 22, 2024
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary. However, despite that the Win32 subsystem allows single quote, the terminal control does not escape it. It causes a path containing one or more single quotes incorrect on the POSIX shell context (see Issue microsoft#18006 for an example). With this commit, the terminal control escapes a single quote with a valid escape sequence `'\''` (finish quote, print a single quote then begin quote again).
a4lg
added a commit
to a4lg/terminal
that referenced
this issue
Nov 22, 2024
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary. However, despite that the Win32 subsystem allows single quote, the terminal control does not escape it. It causes a path containing one or more single quotes incorrect on the POSIX shell context (see Issue microsoft#18006 for an example). With this commit, the terminal control escapes a single quote with a valid escape sequence `'\''` (finish quote, print a single quote then begin quote again).
a4lg
added a commit
to a4lg/terminal
that referenced
this issue
Nov 22, 2024
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary. However, despite that the Win32 subsystem allows single quote, the terminal control does not escape it. It causes a path containing one or more single quotes incorrect on the POSIX shell context (see Issue microsoft#18006 for an example). With this commit, the terminal control escapes a single quote with a valid escape sequence `'\''` (finish quote, print a single quote then begin quote again).
a4lg
added a commit
to a4lg/terminal
that referenced
this issue
Nov 23, 2024
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary. However, despite that the Win32 subsystem allows single quote, the terminal control does not escape it. It causes a path containing one or more single quotes incorrect on the POSIX shell context (see Issue microsoft#18006 for an example). With this commit, the terminal control escapes a single quote with a valid escape sequence `'\''` (finish quote, print a single quote then begin quote again) when the path translation is required.
a4lg
added a commit
to a4lg/terminal
that referenced
this issue
Nov 23, 2024
When file/folder is dropped to the terminal, its path is translated and quoted with a pair of single quotes if necessary. However, the terminal control does not escape single quotes (allowed in the Win32 subsystem) that need escapes when translated. On the translation styles other than "none" (note: all other translation styles are currently intended for the POSIX shell), it causes incorrect path to be pasted when the path contains one or more single quotes (see Issue microsoft#18006 for an example). With this commit, the terminal control escapes a single quote with a valid escape sequence `'\''` (finish quote, print a single quote then begin quote again) when the path translation is required.
microsoft-github-policy-service
bot
added
the
Needs-Tag-Fix
Doesn't match tag requirements
label
Nov 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area-TerminalControl
Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)
In-PR
This issue has a related PR
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Needs-Tag-Fix
Doesn't match tag requirements
Product-Terminal
The new Windows Terminal.
Windows Terminal version
1.20.11781.0
Windows build number
10.0.26100.0
Other Software
Ubuntu 24.04 (in WSL and
source
ofWindows.Terminal.Wsl
in the profile; any WSL distributions are affected)Steps to reproduce
'
character), sayD:\John's Archive
.Expected Behavior
When
is dropped to a WSL tab, a string which expands to:
(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 afters
is not quoted and will not be preserved.The text was updated successfully, but these errors were encountered: