Thanks a lot. I did what I should have done long ago, and ran PhpStorm in a clean environment (a separate unix account). There I also could not reproduce the problem.
Through a process of elimination, I found the culprit was this line in my ~/.inputrc
:
Control-j: menu-complete
I had ctrl-j/k set as a pair:
Control-j: menu-complete
Control-k: menu-complete-backward
I added this years ago after reading some random “pimp your .inputrc” reddit article.
Why is mapping ctrl-j breaking bashdb? I’ve no idea. I can’t replicate the problem in the command-line:
jturner@jturner-desktop:~$ /usr/bin/bash /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/bashdb --quiet --no-highlight --library /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/share/bashdb --tty /dev/stdout /home/jturner/bashproj/test.sh
(/home/jturner/bashproj/test.sh:3):
3: echo "Hello"
bashdb<0> next
Hello
(/home/jturner/bashproj/test.sh:4):
4: echo "world"
bashdb<1> next
world
(/home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/bashdb:1):
1: #!/usr/bin/bash
bashdb<2> next
Debugged program terminated normally. Use q to quit or R to restart.
When is ctrl-j even being sent?! Google trawling shows a similar bug where binding control-j to menu-complete breaks gdb, and comments there indicate ctrl-j is byte-wise identical to Enter (0x0a
), so perhaps the enter is treated as ctrl-j.
Anyway, one way for BashSupport Pro to disarm this bizarre footgun is to disable ~/.inputrc
reading when bashdb starts. That can be done by setting env var INPUTRC=/dev/null
, i.e.:
INPUTRC=/dev/null /usr/bin/bash /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/bashdb --quiet --no-highlight --library /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/share/bashdb --tty /tmp/bashsupport-bashdb.log /home/jturner/bashproj/test.sh
For the record, here is my idea.log
with -Dpurejavacomm.loglevel=5
in Edit Custom VM Options
, from a broken attempt:
2023-12-04 22:46:38,282 [ 10606] FINE - #bashpro.inspections - Using shellcheck at null
2023-12-04 22:46:38,283 [ 10607] FINE - #bashpro.inspections - Using shellcheck at /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/shellcheck/shellcheck_linux_amd64
2023-12-04 22:46:42,187 [ 14511] INFO - #c.i.o.u.r.RegistryValue - Registry value 'ide.instant.shutdown' has changed to 'false'
2023-12-04 22:46:42,189 [ 14513] FINE - #bashpro.debugger - [0] bashdb process will terminate
2023-12-04 22:46:42,190 [ 14514] FINE - #bashpro.debugger - cmd [0, 1] response: process terminated
2023-12-04 22:46:42,190 [ 14514] FINE - #bashpro.timing - [bashdb.cmdAsync[1]("load /home/jturner/bashproj/test.sh")] took 4195 ms
2023-12-04 22:46:42,190 [ 14514] FINE - #bashpro.debugger - cmd [0, 1] info variables -p
2023-12-04 22:46:42,191 [ 14515] INFO - STDERR - log: > write(347,[18,0x69,0x6E,0x66,0x6F,0x20,0x76,0x61,0x72...],18)
2023-12-04 22:46:42,191 [ 14515] INFO - STDERR - log: < write(347,[18,0x69,0x6E,0x66,0x6F,0x20,0x76,0x61,0x72...],18) => 18
2023-12-04 22:46:42,219 [ 14543] INFO - STDERR - log: > write(350,[1,0x00],1)
2023-12-04 22:46:42,219 [ 14543] INFO - STDERR - log: < poll([4,0x00000160,0x00000001,0x0000015F,0x00100001],2,-1) => 1
2023-12-04 22:46:42,219 [ 14543] INFO - STDERR - log: < poll([4,0x0000015D,0x00010001,0x0000015B,0x00000001],2,-1) => 1
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: > close(347)
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: < write(350,[1,0x00],1) => 1
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: < close(347) => 0
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: > close(351)
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: > write(350,[1,0x00],1)
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: > write(353,[1,0x00],1)
2023-12-04 22:46:42,220 [ 14544] INFO - STDERR - log: < write(350,[1,0x00],1) => 1
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: > close(349)
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: < close(349) => 0
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: > close(350)
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: < close(351) => 0
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: < close(350) => 0
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: > close(348)
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: < write(353,[1,0x00],1) => 1
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: < close(348) => 0
2023-12-04 22:46:42,221 [ 14545] INFO - STDERR - log: > write(353,[1,0x00],1)
2023-12-04 22:46:42,222 [ 14546] INFO - STDERR - log: < write(353,[1,0x00],1) => 1
2023-12-04 22:46:42,222 [ 14546] INFO - STDERR - log: > close(352)
2023-12-04 22:46:42,222 [ 14546] INFO - STDERR - log: < close(352) => 0
2023-12-04 22:46:42,222 [ 14546] INFO - STDERR - log: > close(353)
2023-12-04 22:46:42,222 [ 14546] INFO - STDERR - log: < close(353) => 0
2023-12-04 22:46:42,222 [ 14546] FINE - #bashpro.debugger - [0] bashdb process terminated
2023-12-04 22:46:42,223 [ 14547] FINE - #bashpro.debug - stop called
and working:
2023-12-04 22:45:56,757 [ 13318] FINE - #bashpro.inspections - Using shellcheck at null
2023-12-04 22:45:56,757 [ 13318] FINE - #bashpro.inspections - Using shellcheck at /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/shellcheck/shellcheck_linux_amd64
2023-12-04 22:45:56,760 [ 13321] FINER - #bashpro.license - Current system time: 1701690356760, build time: 1698105600000
2023-12-04 22:45:56,760 [ 13321] FINE - #bashpro.inspections - no custom path configured
2023-12-04 22:45:56,760 [ 13321] FINE - #bashpro.inspections - Using shellcheck at null
2023-12-04 22:45:56,760 [ 13321] FINE - #bashpro.inspections - Using shellcheck at /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/shellcheck/shellcheck_linux_amd64
2023-12-04 22:46:02,688 [ 19249] FINE - #bashpro.debug - starting debug process
2023-12-04 22:46:02,694 [ 19255] FINER - #bashpro.license - Current system time: 1701690362693, build time: 1698105600000
2023-12-04 22:46:02,694 [ 19255] FINE - #bashpro.debug - Updating system property for pty4j: /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/lib/pty4j-bashsupport
2023-12-04 22:46:02,705 [ 19266] FINE - #bashpro.interpreter - detected GNU bash, version 5
2023-12-04 22:46:02,716 [ 19277] INFO - STDERR - log: instantiating jtermios.linux.JTermiosImpl
2023-12-04 22:46:02,726 [ 19287] INFO - STDERR - log: > open('/dev/ptmx',00000102)
2023-12-04 22:46:02,727 [ 19288] INFO - STDERR - log: < open('/dev/ptmx',00000102) => 352
2023-12-04 22:46:02,727 [ 19288] INFO - STDERR - log: > open('/dev/pts/1',00000000)
2023-12-04 22:46:02,727 [ 19288] INFO - STDERR - log: < open('/dev/pts/1',00000000) => 353
2023-12-04 22:46:02,728 [ 19289] INFO - STDERR - log: > pipe([2,0,0])
2023-12-04 22:46:02,728 [ 19289] INFO - STDERR - log: < pipe([2,354,355]) => 0
2023-12-04 22:46:02,728 [ 19289] INFO - STDERR - log: > open('/dev/ptmx',00000102)
2023-12-04 22:46:02,728 [ 19289] INFO - STDERR - log: < open('/dev/ptmx',00000102) => 356
2023-12-04 22:46:02,728 [ 19289] INFO - STDERR - log: > pipe([2,0,0])
2023-12-04 22:46:02,728 [ 19289] INFO - STDERR - log: < pipe([2,357,358]) => 0
2023-12-04 22:46:02,834 [ 19395] FINE - #bashpro.debugger - [0] ignoring non-bashdb output '/usr/bin/bash /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/bashdb --quiet --no-highlight --library /home/jturner/.local/share/JetBrains/PhpStorm2023.2/bashsupport-pro/bashdb/5.0/share/bashdb --tty /tmp/bashsupport-bashdb.log /home/jturner/bashproj/test.sh' and type system
2023-12-04 22:46:02,836 [ 19397] INFO - STDERR - log: > poll([4,0x00000162,0x00000001,0x00000160,0x00000001],2,-1)
2023-12-04 22:46:02,837 [ 19398] INFO - STDERR - log: > poll([4,0x00000165,0x00000001,0x00000164,0x00000001],2,-1)
2023-12-04 22:46:03,000 [ 19561] WARN - #c.i.o.a.ActionStub - ActionGroup should be registered using <group> tag: id="bashpro.SendSignal" class="pro.bashsupport.shell.nz"
2023-12-04 22:46:03,090 [ 19651] FINER - #bashpro.debugger - textAvailable: (/home/jturner/bashproj/test.sh:3):
2023-12-04 22:46:03,095 [ 19656] FINER - #bashpro.debugger - textAvailable: 3: echo "Hello"
2023-12-04 22:46:03,095 [ 19656] FINER - #bashpro.debugger - textAvailable: ^[[?2004hbashdb<0>
2023-12-04 22:46:03,099 [ 19660] FINE - #bashpro.timing - [bashdb.awaitReady] took 81 ms
2023-12-04 22:46:03,102 [ 19663] FINE - #bashpro.debug - registerBreakpoint XLineBreakpointImpl(bashpro.debug.shLine at test.sh:2)
2023-12-04 22:46:03,108 [ 19669] FINE - #bashpro.debugger - cmd [0, 1] load /home/jturner/bashproj/test.sh
2023-12-04 22:46:03,108 [ 19669] INFO - STDERR - log: > write(352,[36,0x6C,0x6F,0x61,0x64,0x20,0x2F,0x68,0x6F...],36)
2023-12-04 22:46:03,109 [ 19670] INFO - STDERR - log: < write(352,[36,0x6C,0x6F,0x61,0x64,0x20,0x2F,0x68,0x6F...],36) => 36
2023-12-04 22:46:03,113 [ 19674] FINER - #bashpro.debugger - textAvailable: ^[[?2004l
2023-12-04 22:46:03,113 [ 19674] FINER - #bashpro.debugger - textAvailable:
2023-12-04 22:46:03,119 [ 19680] FINER - #bashpro.debugger - textAvailable: File /home/jturner/bashproj/test.sh loaded.
2023-12-04 22:46:03,120 [ 19681] FINER - #bashpro.debugger - textAvailable: ^[[?2004hbashdb<1>
2023-12-04 22:46:03,120 [ 19681] FINE - #bashpro.debugger - cmd [0, 1] response: File /home/jturner/bashproj/test.sh loaded.\n
2023-12-04 22:46:03,121 [ 19682] FINE - #bashpro.timing - [bashdb.cmdAsync[1]("load /home/jturner/bashproj/test.sh")] took 15 ms
2023-12-04 22:46:03,121 [ 19682] FINE - #bashpro.debugger - cmd [0, 2] info variables -p
2023-12-04 22:46:03,121 [ 19682] INFO - STDERR - log: > write(352,[18,0x69,0x6E,0x66,0x6F,0x20,0x76,0x61,0x72...],18)
2023-12-04 22:46:03,121 [ 19682] INFO - STDERR - log: < write(352,[18,0x69,0x6E,0x66,0x6F,0x20,0x76,0x61,0x72...],18) => 18
2023-12-04 22:46:03,126 [ 19687] FINER - #bashpro.debugger - textAvailable: ^[[?2004l
2023-12-04 22:46:03,127 [ 19688] FINER - #bashpro.debugger - textAvailable:
2023-12-04 22:46:03,133 [ 19694] FINER - #bashpro.debugger - textAvailable: -x ANSIBLE_NOCOWS="1"
2023-12-04 22:46:03,134 [ 19695] FINER - #bashpro.debugger - textAvailable: -- BASH="/usr/bin/bash"
2023-12-04 22:46:03,136 [ 19697] FINER - #bashpro.debugger - textAvailable: -r BASHOPTS="checkwinsize:cmdhist:complete_fullquote:extdebug:extquote:force_fignore:globasciiranges:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath"
2023-12-04 22:46:03,137 [ 19698] FINER - #bashpro.debugger - textAvailable: -A BASH_ALIASES=()
Many thanks for your excellent support. I have a 17kloc bash codebase for which interactive debugging could be very helpful.