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

Initiating debug produces `stty: stdin isn't a terminal` in debug console

Open mfour-merickson opened this issue 6 years ago • 11 comments

Running on MacOS, receive stty: stdin isn't a terminal

Executables

❯ bashdb --version bashdb, release 4.4-0.94

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'

❯ ci --version 1.24.0-insider 92754223624dcbe9aca0e5ca3ba8a53808b122b6 x64

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:

        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (select script from list of sh files)",
            "cwd": "${workspaceFolder}",
            "program": "${command:SelectScriptName}",
            "args": []
        },

mfour-merickson avatar Jun 03 '18 16:06 mfour-merickson

Unfortunately i do not have macOS to reproduce this. Please answer following questions:

  • Does this fail always (for any script) ?
  • Does this fail at startup, or during execution of script?

rogalmic avatar Jun 04 '18 08:06 rogalmic

Reproduced on Ubuntu 18.04 ~~when debugging NetBSD's build.sh~~ on any script. Maybe comes from changes in latest bashdb, I'll describe details later.

wataash avatar Jun 04 '18 08:06 wataash

Unfortunately i do not have macOS to reproduce this. Please answer following questions:

Does this fail always (for any script) ?

Yes, it fails for any and all scripts. Further, see what @rogalmic had to say (it is not on OS thing based on this report)

Does this fail at startup, or during execution of script?

Fails on startup

mfour-merickson avatar Jun 04 '18 15:06 mfour-merickson

I tried on Windows with following bashdb:

/mnt/c/Users/rogal_000$ bashdb --version
bashdb, release 4.4-0.94

Works fine (also with mentioned build.sh), so the problem seems to be not related only to bashdb.

rogalmic avatar Jun 04 '18 19:06 rogalmic

git-bisecting revealed bashdb@4e1479d is the bad commit, certainly introducing the use of stty command. I think the author didn't consider a situation where bashdb's fd[0-2] are connected to pipes.

As a workaround, we can avoid this bug by using bashdb-4.4-0.92 or before.

wataash avatar Jun 05 '18 11:06 wataash

Here's a screenshot:

image

Once debugging has started, we can't stop it nor even restarted it.

The error message stty: 'standard input': Inappropriate ioctl for device differs from @mfour-merickson's one since they are output by stty:

  • https://opensource.apple.com/source/adv_cmds/adv_cmds-149/stty/stty.c
    • errx(1, "stdin isn't a terminal");
  • https://github.com/coreutils/coreutils/blob/v8.28/src/stty.c#L1782

wataash avatar Jun 05 '18 12:06 wataash

@wataash : What do you think would be correct way to fix that? Can we propose a fix to bashdb, or vscode-bash-debug needs refactoring?

rogalmic avatar Jun 05 '18 12:06 rogalmic

I think we should modify launchRequestFinalize first.

Maintaining text parsing code is painful, but I think we should not request the backward compatibilities of bashdb's output. Instead, we could request machine-friendry interface like gdb -i=mi.

I hope I'll get down to this work soon... :)

wataash avatar Jun 05 '18 14:06 wataash

I am trying to install using homebrew, without much success, is this the correct syntax (I am sure I have installed specific formulas in the past with this approach)


brew install bashdb 4.4-0.92

mfour-merickson avatar Jun 05 '18 15:06 mfour-merickson

A related bashdb bug report and a proposed fix with can be found in https://sourceforge.net/p/bashdb/bugs/58/.

hablutzel1 avatar Mar 28 '20 02:03 hablutzel1