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

BashDB Not Working in Nixvim DAP Configuration #3

Open
back2nix opened this issue Jul 21, 2024 · 0 comments
Open

BashDB Not Working in Nixvim DAP Configuration #3

back2nix opened this issue Jul 21, 2024 · 0 comments

Comments

@back2nix
Copy link

back2nix commented Jul 21, 2024

Description

Greetings! 😃

I'd like to share an interesting observation regarding the behavior of BashDB when debugging Bash scripts using the Debug Adapter Protocol (DAP) configuration in Neovim. I've noticed that the debugger exits with code 1 and produces several intriguing error messages:

  1. The complete command is missing, which might indicate issues with Bash autocompletion setup.
  2. There are difficulties accessing /dev/stdin. This could be related to peculiarities in file permission management or standard input handling in the Nix environment.
  3. BashDB reports the need for specifying a script to debug or using the -c option. It appears that the file or command for debugging isn't being passed to the debugger correctly.

These observations may be valuable for understanding the current state of interaction between BashDB, Neovim, and DAP in the context of debugging Bash scripts.

Configuration

my nixvim config:
https://github.com/back2nix/nixvim/blob/14c6325f4745a848048236d70e3287ab65e00646/config/plugins/dap.nix#L28

sh-config:

sh-config = lib.mkIf pkgs.stdenv.isLinux {
  type = "bashdb";
  request = "launch";
  name = "Launch (BashDB)";
  showDebugOutput = true;
  pathBashdb = "${pkgs.bashdb}/bin/bashdb";
  pathBashdbLib = "${pkgs.bashdb}/share/bashdb/lib";
  trace = true;
  file = '${file}';
  program = '${file}';
  cwd = '${workspaceFolder}';
  pathCat = "cat";
  pathBash = "${lib.getExe pkgs.bash}";
  pathMkfifo = "mkfifo";
  pathPkill = "pkill";
  args = {};
  env = {};
  terminalKind = "integrated";
};

https://github.com/back2nix/nixvim/blob/14c6325f4745a848048236d70e3287ab65e00646/config/plugins/dap.nix#L149-L161

DAP Configuration:

plugin.dap = {
  enable = true;
  configurations = {
    sh = lib.optionals pkgs.stdenv.isLinux [sh-config];
  };
  adapters = {
    executables = {
      bashdb = lib.mkIf pkgs.stdenv.isLinux {command = "${lib.getExe pkgs.bashdb}";};
    };
  };
};

Error Messages

[ ERROR ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1466 ]        "stderr"        {
  command = "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/bin/bashdb",
  type = "executable"
}       "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/share/bashdb/lib/help.sh: line 40: complete: command not found\n"

[ ERROR ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1466 ]        "stderr"        {
  command = "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/bin/bashdb",
  type = "executable"
}       "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/share/bashdb/command/source.sh: line 41: /dev/stdin: No such device or address\n"

[ ERROR ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1466 ]        "stderr"        {
  command = "/nix/store/15lnx94a6ajjp95zm2kjg1y79xc1z1s2-bashdb-5.0-1.1.2/bin/bashdb",
  type = "executable"
}       ".bashdb-wrapped: need to give a script to debug or use the -c option.\n"

[ INFO ] 2024-07-21T14:13:31Z+0300 ] ...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1439 ] "Process closed"        1132885

Additional Information

Using, which is built with a custom overlay, resolves the:
"complete: command not found" error. 😃

  • overlays
(final: prev: {
  bashdbInteractive = final.bashdb.overrideAttrs {
    buildInputs = (prev.buildInputs or []) ++ [final.bashInteractive];
  };
})
  • change config
...
pathBashdb = "/etc/profiles/per-user/bg/bin/bashdb"
...
executables = {
      bashdb = lib.mkIf pkgs.stdenv.isLinux {command = "/etc/profiles/per-user/bg/bin/bashdb";};
    };

However, the error
"need to give a script to debug or use the -c option."
persists. 😞

Extensive research and attempts to solve the problem have been unsuccessful. 😞

@khaneliman khaneliman transferred this issue from khaneliman/khanelinix Aug 16, 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