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

Support "argsCanBeInterpretedByShell" property #169

Open
HankAviator opened this issue Jul 29, 2022 · 2 comments
Open

Support "argsCanBeInterpretedByShell" property #169

HankAviator opened this issue Jul 29, 2022 · 2 comments

Comments

@HankAviator
Copy link

In addition to the details for issue, please provide us Executables information and Debug output unless you have confidence that they don't help us.

Executables

Version of bash-debug: (can be checked in: ctrl+shift+X or command+shift+X -> INSTALLED: Bash Debug)
v0.3.9
Output of following commands (on windows, execute them in Command Prompt or PowerShell):

where bash
C:\Windows\System32\bash.exe

# if `code` not found on macOS, follow the instructions in:
# https://code.visualstudio.com/docs/setup/mac
code --version
1.69.2
3b889b090b5ad5793f524b5d1d39fda662b96a2a
x64
bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'
Linux 1R6RKL3 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
---
/usr/bin/bash
/bin/bash
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
---
/bin/bash: bashdb: command not found
---
/usr/bin/cat
/bin/cat
cat (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund and Richard M. Stallman.
---
/usr/bin/mkfifo
/bin/mkfifo
mkfifo (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
---
/usr/bin/pkill
/bin/pkill
pkill from procps-ng 3.3.16

Debug output

Paste here outputs in DEBUG CONSOLE (ctrl+shift+D or command+shift+D) with "showDebugOutput": true and "trace": true in launch.json.

{
	// Use IntelliSense to learn about possible attributes.
	// Hover to view descriptions of existing attributes.
	// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
	"version": "0.2.0",
	"configurations": [

		{
			"type": "bashdb",
			"request": "launch",
			"name": "Bash-Debug (simplest configuration)",
			"cwd": "${workspaceFolder}",
			"program": "${file}",
			"terminalKind": "integrated",
			"showDebugOutput":true,
			"trace": true
		}
	]
}

Details

Terminal output:

root@1R6RKL3:/mnt/c/Program Files/Microsoft VS Code#  wsl.exe bash -c "cd ""/mnt/d/temp""; while [[ ^! -p ""/tmp/vscode-bash-debug-fifo-15294"" ]]; do sleep 0.25; done; ""bash"" ""/mnt/c/Users/Han/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb"" --quiet --tty ""/tmp/vscode-bash-debug-fifo-15294"" --tty_in ""/tmp/vscode-bash-debug-fifo-15294_in"" --library ""/mnt/c/Users/Han/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir"" -- ""/mnt/d/temp/Untitled-1.sh""  " 
bash: -c: line 0: conditional binary operator expected
bash: -c: line 0: syntax error near `-p'
bash: -c: line 0: `cd /mnt/d/temp; while [[ ^! -p /tmp/vscode-bash-debug-fifo-15294 ]]; do sleep 0.25; done; bash /mnt/c/Users/Han/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb --quiet --tty /tmp/vscode-bash-debug-fifo-15294 --tty_in /tmp/vscode-bash-debug-fifo-15294_in --library /mnt/c/Users/Han/.vscode/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir -- /mnt/d/temp/Untitled-1.sh  '

the issue is

`while [[ ! -p "${fifo_path}" ]]; do sleep 0.25; done`,

is not correctlyly passed to the integrated terminal, an additional ^ is added. Removing this ^ will make the debugger work.
no such issue when "terminalKind": "debugConsole"
Issue didn't exist earlier, still worked in Januaray 2022.

@HankAviator
Copy link
Author

suspected 3rd party bug: microsoft/vscode#156657

@HankAviator
Copy link
Author

Update: VS Code maintainer answered how to solve this issue. Can you have a look at the description below? I tried to find a way to fix this but I don't quite know how...

VS Code will now shell-escape arguments passed to the runInTerminal request. Extensions should set argsCanBeInterpretedByShell to prevent that: https://github.com/microsoft/debug-adapter-protocol/blob/main/debugAdapterProtocol.json#L783

Originally posted by @roblourens in microsoft/vscode#156657 (comment)

@HankAviator HankAviator reopened this Dec 6, 2022
@HankAviator HankAviator changed the title Wrong command passed to wsl integrated terminal Support "argsCanBeInterpretedByShell" property Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant