dbux: [Bug] dbux is assuming `bash` in Windows resolves to MINGW/MSYS bash

Bug Report

Bug Summary dbux seems to assume that running bash in Windows will start some sort of MINGW/MSYS bash such as Git bash. However, by default, the only bash.exe in Windows will be the wrapper that launches /bin/bash in the default WSL distro (if WSL is enabled).

Steps To Reproduce

  1. Make sure WSL is installed
  2. Open some JavaScript file and click “Start DBux”
  3. See error in terminal

Expected behavior dbux should either not require a specific kind of bash installed at all or tell the user exactly what is expected and ask for its location if it’s not in PATH.

Actual behavior dbux launches bash which by default will by C:\Windows\System32\bash.exe (a helper to launch bash inside WSL). It then fails with a misleading file-not-found error message because it launches node from the shell which is now inside WSL and passes a Windows-style path to it.

The loading box [Dbux] : New version. Installing 1 library/ies (1-3 mins)... then stays there forever.

Attachments

Screenshots image

System (please complete the following information):

  • OS: Windows 10
  • Dbux VSCode Extension version: 0.6.15

(I updated the bug description based on what the actual problem is, because my initial assumption was wrong.)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 27 (27 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you!

I just realized this probably (?) has nothing to do with my terminal shell being configured to WSL bash in particular, as I first assumed - instead it seems you simply invoke bash, which will be the Linux bash if WSL is installed on the system (which, in my opinion, is no edge case for a JavaScript developer nowadays).

I fixed the issue by changing the new bash path option to C:\Program Files\Git\bin\bash.exe.

(By the way: In a WSL window, running DBux works fine.)

Ah I see what you mean (I didn’t realize it’s what’s used for running the code too, I thought it was just part of the installation process), yes if it’s configurable it should be fine.

Output channel log: sorry I (apparently wrongly) thought you meant what was already in the terminal.

@CherryDT Good news. After you helped us understand how wrong our assumptions were about bash on windows, I realized that there will definitely be a good amount of people who would be hampered by this issue. Also, in previous experiments, getting bash right was definitely an issue that slowed people down. That is why I decided today to just rip the bandage off and get this done.

In the process, we had to discover and tussle with this volta bug - cross-platform dev is such fun!

Either way - I finished the “use cmd on windows” solution today, will test more, and then deploy in the next few days!

OK yes if you do that, it does, but it’s not recommended because it overwrites other tools like find. Also, if you use the “modern way” Windows provides for a while, using Windows’ built-in package manager WinGet, you won’t get asked. (Note that even the Git download page shows the WinGet command line you can use.)

Update: Actually, I realized now, it does not work correctly in a WSL window, because now it seems to use the custom path I set in the regular VSCode window also for the WSL window, so while it initally uses the right bash it then passes the Windows path that I set into the script…

Something doesn’t make sense here - in the WSL tab of the settings it shows bash but “modified in: User”, while in the User tab it shows my Windows path - however in a regular VSCode window that User tab is the only place I can change it, so I’m stuck again…

image

image

david@CHE-T14S:~/.vscode-server/extensions/domi.dbux-code-0.6.15 $ "node" "/home/david/.vscode-server/extensions/domi.dbux-code-0.6.15/resources/src/_dbux_run.js" 1 eyJjd2QiOiIvaG9tZS9kYXZpZC8udnNjb2RlLXNlcnZlci9leHRlbnNpb25zL2RvbWkuZGJ1eC1jb2RlLTAuNi4xNSIsImNvbW1hbmQiOiJcIm5wbVwiIGluc3RhbGwgLS1vbmx5PXByb2QiLCJ0bXBGb2xkZXIiOiIvdG1wL2RidXgtNVNIMnpTIiwic2hlbGwiOiJDOlxcUHJvZ3JhbSBGaWxlc1xcR2l0XFxiaW5cXGJhc2guZXhlIn0=
[Dbux run.js] command received: {
  nodePath: '/home/david/.asdf/installs/nodejs/16.10.0/bin/node',
  cwd: '/home/david/.vscode-server/extensions/domi.dbux-code-0.6.15',
  command: '"npm" install --only=prod',
  tmpFolder: '/tmp/dbux-5SH2zS',
  shell: 'C:\\Program Files\\Git\\bin\\bash.exe'
}
Error: Error: spawn C:\Program Files\Git\bin\bash.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn C:\\Program Files\\Git\\bin\\bash.exe',
  path: 'C:\\Program Files\\Git\\bin\\bash.exe',
  spawnargs: [ '-c', '"npm" install --only=prod' ]
}

How can I make it work correctly in both regular and WSL windows in VSCode?

Another thing I noticed: I saw a connection error in the terminal, but dbux then apparently issued another (different) command even though the first one failed - shouldn’t this abort the operation entirely?

[Dbux run.js] (Terminal task running for 590.59 seconds.)
[Dbux run.js] (Terminal task running for 600.59 seconds.)
[Dbux run.js] (Terminal task running for 610.60 seconds.)
[Dbux run.js] (Terminal task running for 620.61 seconds.)
npm ERR! code ECONNABORTED
npm ERR! syscall connect
npm ERR! errno ECONNABORTED
npm ERR! request to https://registry.npmjs.org/@datastructures-js%2fpriority-queue failed, reason: connect ECONNABORTED 104.16.26.35:443

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\david\AppData\Local\npm-cache\_logs\2022-03-25T16_02_49_895Z-debug-0.log

david@CHE-T14S MINGW64 ~/.vscode/extensions/domi.dbux-code-0.6.15
$ "node" "C:/Users/david/.vscode/extensions/domi.dbux-code-0.6.15/resources/src/_dbux_run.js" 1 eyJjd2QiOiJDOi9Vc2Vycy9kYXZpZC8udnNjb2RlL2V4dGVuc2lvbnMvZG9taS5kYnV4LWNvZGUtMC42LjE1IiwiY29tbWFuZCI6IlwiQzpcXFByb2dyYW0gRmlsZXNcXG5vZGVqc1xcbnBtLmNtZFwiIGkgQGRidXgvY2xpQDAuNi4xNSIsInRtcEZvbGRlciI6IlI6L1RlbXAvZGJ1eC01S29pNDMiLCJzaGVsbCI6IkM6XFxQcm9ncmFtIEZpbGVzXFxHaXRcXGJpblxcYmFzaC5leGUifQ==
[Dbux run.js] command received: {
  nodePath: 'C:\\Program Files\\nodejs\\node.exe',
  cwd: 'C:/Users/david/.vscode/extensions/domi.dbux-code-0.6.15',
  command: '"C:\\Program Files\\nodejs\\npm.cmd" i @dbux/cli@0.6.15',
  tmpFolder: 'R:/Temp/dbux-5Koi43',
  shell: 'C:\\Program Files\\Git\\bin\\bash.exe'
}
[Dbux run.js] (Terminal task running for 10.00 seconds.)
[Dbux run.js] (Terminal task running for 20.01 seconds.)
[Dbux run.js] (Terminal task running for 30.01 seconds.)
[Dbux run.js] (Terminal task running for 40.03 seconds.)
[Dbux run.js] (Terminal task running for 50.03 seconds.)
[Dbux run.js] (Terminal task running for 60.04 seconds.)
[Dbux run.js] (Terminal task running for 70.04 seconds.)

Also, I noticed when I click “Start DBux” it goes to a screen that looks like it already started, even when it’s not ready yet. If the commands then fail, the only way to go back to the previous screen with “Start DBux” on it is to reload the window…