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

It does not work using the extension Remote Development v0.25.0 and being debugging inside the docker environment #195

Open
ldrahnik opened this issue Oct 11, 2024 · 2 comments

Comments

@ldrahnik
Copy link

ldrahnik commented Oct 11, 2024

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)

Bash Debugf
v0.3.9

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

/workspaces/project_name # where bash
/bin/sh: where: not found
/workspaces/project_name # bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'
Linux 1b98d84450d2 5.14.0-388.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 21 10:17:52 UTC 2023 x86_64 Linux
---
/bin/bash
GNU bash, version 5.2.26(1)-release (x86_64-alpine-linux-musl)
Copyright (C) 2022 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.
---
bash: line 1: bashdb: command not found
---
/bin/cat
cat: unrecognized option: version
BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

Usage: cat [-nbvteA] [FILE]...

Print FILEs to stdout

        -n      Number output lines
        -b      Number nonempty lines
        -v      Show nonprinting characters as ^x or M-x
        -t      ...and tabs as ^I
        -e      ...and end lines with $
        -A      Same as -vte
---
/usr/bin/mkfifo
mkfifo: unrecognized option: version
BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

Usage: mkfifo [-m MODE] NAME

Create named pipe

        -m MODE Mode (default a=rw)
---
/usr/bin/pkill
pkill: unrecognized option: version
BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

Usage: pkill [-l|-SIGNAL] [-xfvnoe] [-s SID|-P PPID|PATTERN]

Send signal to processes selected by regex PATTERN

        -l      List all signals
        -x      Match whole name (not substring)
        -f      Match against entire command line
        -s SID  Match session ID (0 for current)
        -P PPID Match parent process ID
        -v      Negate the match
        -n      Signal the newest process only
        -o      Signal the oldest process only
        -e      Display name and PID of the process being killed
        -u EUID Match against effective UID
        -U UID  Match against UID

Debug output

I tried to put a breakpoint to the testing_debugging.sh:

#!/usr/bin/env bash
export NICE_VAR=10
export ANOTHER_VAR=20
for i in {0..25..5}
do
  export NICE_VAR=$NICE_VAR+$i
  echo $NICE_VAR
done
for ((i=1;i<=25;i+=1))
do
  export ANOTHER_VAR=$ANOTHER_VAR+$i
  echo $ANOTHER_VAR
done
if [ $ANOTHER_VAR -gt $NICE_VAR ]
then
  echo "ANOTHER bigger than nice"
else
  echo "Nice is bigger or equal"
fi

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}",
      "showDebugOutput": true,
      "terminalKind": "integrated",
      "trace": true
    }
  ]
}

settings.json:

{
  "r.alwaysUseActiveTerminal": true,
  "r.bracketedPaste": true,
  "r.sessionWatcher": true,
  "r.plot.useHttpgd": true,
  "r.lsp.diagnostics": false
}

Debug console:

::PROXYID::93900
(/workspaces/project_name/src/testing_debugging.sh:2):
2:	export NICE_VAR=10

Terminal:

/vscode/vscode-server/bin/linux-alpine/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 #  bash -c cd\ \"/workspaces/project_name\"\;\ while\ \[\[\ \!\ -p\ \"/tmp/vscode-bash-debug-fifo-19340\"\ \]\]\;\ do\ sleep\ 0.25\;\ done\;\ \
"bash\"\ \"/root/.vscode-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb\"\ --quiet\ --tty\ \"/tmp/vscode-bash-debug-fifo-19340\"\ --tty_in\ \"/tmp/vscode-bash-debug-fifo-19340_in\"\ --library\ \"/root/.vscod
e-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir\"\ --\ \"/workspaces/project_name/app/src/testing_debugging.sh\"\ \

devcontainer.json

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
	"name": "Existing Docker Compose (Extend)",

	// Update the 'dockerComposeFile' list if you have more compose files or use different names.
	// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
	"dockerComposeFile": [
		"../docker-compose.yml",
    "docker-compose.yml"
	],

	// The 'service' property is the name of the service for the container that VS Code should
	// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
	"service": "job",

	// The optional 'workspaceFolder' property is the path VS Code should open by default when
	// connected. This is typically a file mount in .devcontainer/docker-compose.yml
	"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Uncomment the next line if you want start specific services in your Docker Compose config.
	// "runServices": [],

	// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
	// "shutdownAction": "none",

	// Uncomment the next line to run commands after the container is created.
	// "postCreateCommand": "cat /etc/os-release",

	// Configure tool-specific properties.
	// "customizations": {},
  "customizations": {
    "vscode": {
        "extensions": [
            // bash Extensions
            "rogalmic.bash-debug",
            // R Extensions
            "rdebugger.r-debugger",
            "reditorsupport.r",
            // Documentation Extensions
            "quarto.quarto",
            "purocean.drawio-preview",
            "redhat.vscode-yaml",
            "yzhang.markdown-all-in-one",
            // Docker Supporting Extensions
            "ms-azuretools.vscode-docker",
            "ms-vscode-remote.remote-containers",
            // Python Extensions
            "ms-python.python",
            "ms-toolsai.jupyter"
        ],
        "settings": {
          "python.defaultInterpreterPath": ".venv/bin/python"
        }
    }
  }

	// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "devcontainer"
}

docker-compose.yml

version: '3.8'
services:
  # Update this to the name of the service you want to work with in your docker-compose.yml file
  job:
    # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
    # folder. Note that the path of the Dockerfile and context is relative to the *primary*
    # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
    # array). The sample below assumes your primary file is in the root of your project.
    #
    # build:
    #   context: .
    #   dockerfile: .devcontainer/Dockerfile

    volumes:
      # Update this to wherever you want VS Code to mount the folder of your project
      - ..:/workspaces:cached

    # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
    # cap_add:
    #   - SYS_PTRACE
    # security_opt:
    #   - seccomp:unconfined

    # Overrides default command so things don't shut down after the process ends.
    command: sleep infinity
services:
  job:
    build:
      context: ./app
      dockerfile: Dockerfile
    restart: unless-stopped

Dockerfile

FROM alpine:3.20.3

RUN apk add R=~4.4.0
RUN apk add R-dev R-doc build-base automake autoconf ttf-freefont linux-headers bash curl py3-pip py3-virtualenv wget
RUN apk add libxml2-dev freetype-dev fontconfig-dev fribidi-dev harfbuzz-dev tiff-dev jpeg-dev mysql-dev
RUN apk add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community

CMD ["/usr/sbin/crond", "-f"]
@ldrahnik
Copy link
Author

ldrahnik commented Oct 12, 2024

With "terminalKing": "debugControle":

From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"bashdb","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":false,"supportsEvaluateForHovers":true,"supportsStepBack":false,"supportsSetVariable":false}}
From client: launch({"type":"bashdb","request":"launch","name":"Bash-Debug (simplest configuration)","cwd":"/workspaces/project_name","program":"/workspaces/project_name/app/src/testing_debugging.sh","showDebugOutput":true,"terminalKind":"debugConsole","trace":true,"__configurationTarget":6,"args":[],"argsString":"","env":{},"pathBash":"bash","pathBashdb":"/root/.vscode-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb","pathBashdbLib":"/root/.vscode-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir","pathCat":"cat","pathMkfifo":"mkfifo","pathPkill":"pkill","__sessionId":"895c0025-45ef-4da0-b607-a50875295bff"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"::PROXYID::162745\n"}}
::PROXYID::162745
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"/root/.vscode-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/command/source.sh: line 41: /dev/stdin: No such device or address\n"}}
/root/.vscode-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/command/source.sh: line 41: /dev/stdin: No such device or address
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"(/workspaces/project_name/app/src/testing_debugging.sh:5):\n5:\texport NICE_VAR=10\n"}}
(/workspaces/project_name/app/src/testing_debugging.sh:5):
5:	export NICE_VAR=10
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Sending StoppedEvent"}}
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"break","threadId":42}}
From client: threads(undefined)
To client: {"seq":0,"type":"response","request_seq":3,"command":"threads","success":true,"body":{"threads":[{"id":42,"name":"Bash thread"}]}}
2
From client: stackTrace({"threadId":42,"startFrame":0,"levels":20})

@ldrahnik ldrahnik changed the title Works locally but does not work using extension Remote Development v0.25.0 and devcontainer.json Does not work using extension Remote Development v0.25.0 and docker wrapped by devcontainer.json Oct 12, 2024
@ldrahnik
Copy link
Author

ldrahnik commented Oct 12, 2024

Found existing issue #101. I can confirm that connecting through ssh without being inside the docker environment this extension works (purely on the remote host environment).

@ldrahnik ldrahnik changed the title Does not work using extension Remote Development v0.25.0 and docker wrapped by devcontainer.json It does not work using the extension Remote Development v0.25.0 and being debugging inside the docker environment Oct 12, 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