vscode-bash-debug icon indicating copy to clipboard operation
vscode-bash-debug copied to clipboard

Error: Only bash versions 4.* are supported

Open rfencl opened this issue 6 years ago • 16 comments

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)

Output of following commands (on windows, execute them in Command Prompt or PowerShell):

where bash
# if `code` not found on macOS, follow the instructions in:
# https://code.visualstudio.com/docs/setup/mac
code --version
bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'

Debug output

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

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash Debug",
            "program": "${workspaceFolder}/src/foo.sh",
            "showDebugOutput": true,
            "trace": true
        }
    ]
}

Details

Details goes here.

rfencl avatar Jul 12 '19 21:07 rfencl

Version of bash-debug 0.3.5 $ where bash C:\Program Files\Git\usr\bin\bash.exe or using wsl $ where bash /bin/bash

No Debug appears the error dialog pops up right away.

rfencl avatar Jul 12 '19 22:07 rfencl

This is by design, only bash 4.* and 5.* is supported. There were some issues with earlier bash versions related to underlying bashdb...

rogalmic avatar Jul 13 '19 05:07 rogalmic

I'm sorry I assumed you knew I was using bash 4.

GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

rfencl avatar Jul 13 '19 21:07 rfencl

This is the check done in extension, please run it and paste results:

echo "$BASH_VERSION"; [[ "$BASH_VERSION" == 4.* ]] || [[ "$BASH_VERSION" == 5.* ]] || echo "unsupported";

rogalmic avatar Jul 14 '19 11:07 rogalmic

The design that only support 4.* and 5.* makes it not works on Mac

My Mac os version is macOS Mojave 10.14.2 which is almost the latest version of macOS . But the bash version is 3.2.57(1)-release . image

LucianLiu6 avatar Jul 17 '19 02:07 LucianLiu6

I decided to upgrade bash to work around this. This article helped me:

https://itnext.io/upgrading-bash-on-macos-7138bd1066ba

Running macOS Mojave 10.14.5 here.

migsc avatar Aug 02 '19 18:08 migsc

I'm also having this problem, on Windows 10 x64 using WSL.

If I execute the requested command, Unsupported is returned. If I execute only echo "$BASH_VERSION" then nothing is returned. In my use case, I have determined this is caused by the fact that my login shell is not bash, but zsh. As such, $BASH_VERSION is not set when this extension tries to check the variable. Perhaps a query against the bash binary instead?

Jekotia avatar Aug 08 '19 18:08 Jekotia

Same problem here. Using ZSH as my shell. Even is i export BASH_VERSION and run the script i get the same error.

Gurran avatar Aug 20 '19 13:08 Gurran

For ZSH debugging, please use https://marketplace.visualstudio.com/items?itemName=rogalmic.zsh-debug .

rogalmic avatar Aug 20 '19 13:08 rogalmic

For ZSH debugging, please use https://marketplace.visualstudio.com/items?itemName=rogalmic.zsh-debug .

This isn't a ZSH issue, though. The issue is in how the BASH version is detected. I write bash-compliant scripts and execute them using bash. I use ZSH for my interactive shell only, not as a script executor. If this extension detected bash via the binary instead of the environment, it would find a valid version of bash which it could then use.

Jekotia avatar Aug 21 '19 15:08 Jekotia

It's ludicrous to not be downstream compatible with bash version 3. Please find a way to fix the debugger for bash 3 instead of taking the easy way out and thereby excluding a large number of people from using the tool.

JuergenSimon avatar Nov 23 '19 12:11 JuergenSimon

I'm also having this problem, on Windows 10, but not using wsl - In wsl it works. I see two solutions: a) change file where the extension looks for $BASH_VERSION b) change file where bash binary is called with the version

tik9 avatar Jun 19 '21 09:06 tik9

Same problem on Mac, brew install bash to insatll latest bash, quit VS Code and reopen to make it find the latest bash.

reyesyang avatar Aug 21 '22 13:08 reyesyang

I updated bash with brew install bash as above and still got the error. I ran the following: $ which bash

/usr/local/bin/bash $ /usr/local/bin/bash --version GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin21.1.0)

I added the following to my .zshrc file. export BASH_VERSION='5.1.16(1)-release'

The debugger now properly launches bash 5 despite my still using zsh as my interactive shell. It's a workaround that we shouldn't have to do, but at least it works.

tbroset avatar Aug 23 '22 21:08 tbroset

In my case $BASH_VERSION is empty, bash --version is 5.1.16(1)-release, and exporting from .zshrc / .bashrc seems not to have any effect. It works for WSL remote. Otherwise it works from windows if the following two environmental variables are set:

BASH_VERSION='5.1.16(1)-release'

WSLENV=BASH_VERSION/u

jonkers3 avatar Aug 27 '22 01:08 jonkers3

After playing around with several settings, I finally got this to work by specifying the path to the right version of bash in the launch settings: ... "request": "launch", "name": "Bash-Debug", "pathBash": "/usr/local/bin/bash", "cwd": "${workspaceFolder}",... note, i too have 5.1.16(1)-release as my primary bash version as applied via homebrew and set via my dotfiles makefile to append to /private/etc/shells then chsh to set as primary. There might be a few other steps that could be taken. Maybe if i put the /usr/local/bin/bash path at the top of the shells file instead of bottom? ...anyway, i have my workaround. i just have to remember to apply it to every bashdebug launch config

mike-mcnamara avatar Oct 26 '22 14:10 mike-mcnamara