vscode-bash-debug
vscode-bash-debug copied to clipboard
Support for msys2 bash
Executables
Version of bash-debug: 0.3.3
c:\> where bash
C:\Windows\System32\bash.exe
# executed from msys2 bash:
c:\> c:\msys64\msys2_shell.cmd -mingw64 -defterm -here -no-start
$ where bash
C:\msys64\usr\bin\bash.exe
C:\Windows\System32\bash.exe
c:\> code --version
1.30.1
dea8705087adb1b5e5ae1d9123278e178656186a
x64
# executed from msys2 bash:
c:\> c:\msys64\msys2_shell.cmd -mingw64 -defterm -here -no-start
$ bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --
version; done'
MINGW64_NT-10.0 superputte 2.11.1(0.329/5/3) 2018-09-10 14:19 x86_64 Msys
---
/usr/bin/bash
/bin/bash
/c/Windows/System32/bash
GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
Copyright (C) 2016 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.
---
which: no bashdb in (/home/henrik/usr/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
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.12
Debug output
N/A
Details
Is it possible to use msys2 bash as an alternative to wsl.exe? wsl (ubuntu 18.04) works fine but I would like to debug some scripts under msys2.
For now this is not supported, but i will add it to potential TODO list.
The problem here might be another filesystem path mapping ( WSL c:\
=> /mnt/c/
, MSYS2 c:\
=> /c/
).
I assume msys2 console cannot handle native windows path, right?
I assume msys2 console cannot handle native windows path, right?
Well, only when enclosed in double quotes '"'.
# The three paths are all equivalent
henrik@superputte MINGW64 ~
$ ls "c:\this\path does\exist" \
> c:/this/path\ does/exist \
> /c/this/path\ does/exist
'/c/this/path does/exist':
'some file.txt'
'c:/this/path does/exist':
'some file.txt'
'c:\this\path does\exist':
'some file.txt'
I don't know how fragile this (heuristic?) system is but I always use the unix style /c/this/path\ does/exist
to be sure.
Looking forward to this feature! Also the bash in git for windows please, which is identical to the msys2 bash.
I took a look at this, it will not be that easy, for example:
- pkill is missing from git bash.exe
- there seems to be some issue with outputting bashdb to fifo file
I will check this fully once I have more time.
I have narrowed it down to this problem:
- open 2 console instances of Git Bash
- start this in first one:
mkfifo /tmp/testpipe ; exec 3<>/tmp/testpipe ; cat <&3
- start this in second:
echo "test" >/tmp/testpipe ; echo "test2" >/tmp/testpipe ;
This works ok when i run two WSL consoles (or in Linux), and seems to be a reason why i cannot get this working.
Any help with solving this would be appreciated, since this is the way how bashdb sends/receives debuuger input/output (stdin and stdout are used for debugged script)...
I have narrowed it down to this problem:
- open 2 console instances of Git Bash consoles
- start this in first one: ...
Thank you very much for your efforts!
@rogalmic - Also big thanks from me. Git bash is derived from msys(2?) which is derived from cygwin. iirc Cygwin should be much closer to POSIX compliance so it may work under cygwin? Could one imagine some thin cygwin layer or shim to emulate the linux pipes? Though of course you wouldn't really be debugging msys/git bash but cygwin in some cases. -> Works in the debugger but not in production, hmm?
I tested cygwin, git-bash, mingw - they all seem to have problems with fifo support.
Like you commented, this is probably because how those windows solutions are designed:
- cygwin
rogalmic@WW302902 /usr/bin
$ /usr/bin/mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
- mingw
rogalmic@WW302902 MINGW64 /bin
$ mount
C:/Program Files/Git on / type ntfs (binary,noacl,auto)
C:/Program Files/Git/usr/bin on /bin type ntfs (binary,noacl,auto)
C:/Users/rogalmic/AppData/Local/Temp on /tmp type ntfs (binary,noacl,posix=0,usertemp)
C: on /c type ntfs (binary,noacl,posix=0,user,noumount,auto)
Underlying bashdb
outputs debug io to some kid of file - hence the fifo usage.
Maybe the best way would be to make fifo work in cygwin/mingw would be to have /tmp
mounted as tmpfs
? I guess this is not supported, possibly by design...