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
[iTerm2, Bash-4.4] shell becomes unresponsive on resize #48
Comments
|
Thank you for the report! But it doesn't reproduce with my environment. I tried
Question 1: I don't have macOS, and there is no $ cat -v <<< "${PS1@P}"Question 2: Is this problem related to your |
The username is redacted.
No, it happens regardless of the used |
|
I was able to reproduce the issue on my linux machine. xfce4-terminal, VTE3-based |
|
Thank you for the information!
This corresponds to the following setting. I tried but the problem wasn't reproduced. PS1='\[\e]133;D;0\a\]\[\e]0;cXXXXXXX@apfelkuchen:~\a\]\[\e]133;A\a\]$ \[\e]133;B\a\]'
OK. Thank you. Then the problem should be somewhere else. Question 3: Is the problem reproduced with a pure environment where only
$ bash --norc
$ source /path/to/ble.sh
|
Thank you. I newly built [murase@chatoyancy 0 ~]$ echo $BLE_VERSION
0.4.0-devel2+5327f5d
[murase@chatoyancy 0 ~]$ echo $BASH_VERSION,$MACHTYPE
5.0.16(1)-release,x86_64-pc-linux-gnu
[murase@chatoyancy 0 ~]$ xfce4-terminal --version
xfce4-terminal 0.8.8 (Xfce 4.14)
``` |
I can't reproduce it that way. I also tried |
|
Thank you! I'll check your config from now. I have another question. In the case that the CPU usage 100% is caused in a shell-script infinite loop, I want to take a shell stack trace of the infinite loop. Question 4: Can you try the following steps to try to get a stack trace?
# bashrc
[[ $- == *i* ]] && source /path/to/blesh/ble.sh --noattach
# ...
trap 'ble-stackdump >/dev/tty' USR1 # <-- ADD THIS LINE
((_ble_bash)) && ble-attach
stackdump:
@ /home/murase/.mwg/src/ble.sh/out/ble.sh:1 (ble-stackdump)
@ something:123 (something)
@ something:321 (something)
@ something:123 (something)Edit: There will be filename paths in the output. If you want to hide your user name, please feel free to replace them! |
Thank you very much for your time and effort.
Done in
Unfortunately there is no output at all. Just a process running on 100% CPU not reacting to any signals but SIGKILL and SIGSTOP. |
OK... Thank you for trying out the stack trace! You can now remove the added line " I'm now checking your configs. Maybe the treatment of Question 5: Can you check if the problem persists after the following steps?
$ cd /path/to/blesh-repository
$ git checkout f1a2818
$ make
$ make INSDIR=~/.local/share/blesh install
Note: if you have finished the check, you can restore the ble.sh repository state by the following commands: $ cd /path/to/blesh-repository
$ git checkout master
$ make
$ make INSDIR=~/.local/share/blesh install |
|
OK, I could reproduce the problem. |
|
It turned out that it is caused by a bug of Bash 4.4+. When $ test_command='f1() { false; return; }; trap "f1 && echo unexpected" WINCH; kill -WINCH 0'
$ bash-2.05b -c "$test_command"
$ bash-3.1 -c "$test_command"
$ bash-3.2 -c "$test_command"
$ bash-4.0 -c "$test_command"
$ bash-4.1 -c "$test_command"
$ bash-4.2 -c "$test_command"
$ bash-4.3 -c "$test_command"
$ bash-4.4 -c "$test_command"
unexpected
$ bash-5.0 -c "$test_command"
unexpected
$ bash-dev -c "$test_command"
unexpectedEdit: Details on Bash changeI was checking the source code of Bash. The related section is $ git blame 7117c2d22 builtins/common.c
7117c2d22 (Jari Aalto 2002-07-17 14:10:11 +0000 496) if (list == 0)
7117c2d22 (Jari Aalto 2002-07-17 14:10:11 +0000 497) return (last_command_exit_value);
$ git blame 939d190e0 builtins/common.c
7117c2d22 (Jari Aalto 2002-07-17 14:10:11 +0000 497) if (list == 0)
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 498) {
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 499) if (this_shell_builtin == return_builtin && running_trap)
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 500) return (trap_saved_exit_value);
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 501) return (last_command_exit_value);
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 502) }
$ git blame e2f12fdf5 builtins/common.c
7117c2d22 (Jari Aalto 2002-07-17 14:10:11 +0000 497) if (list == 0)
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 498) {
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 499) /* If we're not running the DEBUG trap, the return builtin, when not
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 500) given any arguments, uses the value of $? before the trap ran. If
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 501) given an argument, return uses it. This means that the trap can't
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 502) change $?. The DEBUG trap gets to change $?, though, since that is
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 503) part of its reason for existing, and because the extended debug mode
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 504) does things with the return value. */
e2f12fdf5 (Chet Ramey 2014-04-07 10:46:02 -0400 505) if (this_shell_builtin == return_builtin && running_trap > 0 && running_trap != DEBUG_TRAP+1)
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 506) return (trap_saved_exit_value);
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 507) return (last_command_exit_value);
939d190e0 (Chet Ramey 2014-03-21 14:15:01 -0400 508) }The related change logs of Bash are as follows: 3/11
----
builtins/common.c
- get_exitstat: when running `return' in a trap action, and it is not
supplied an argument, use the saved exit status in
trap_saved_exit_value. Fixes Posix problem reported by
Eduardo A. Bustamante L坦pez <dualbus@gmail.com>
3/18
----
builtins/common.c
- get_exitstat: update fix of 3/11 to allow the DEBUG trap to use the
current value of $? instead of the value it had before the trap
action was run. This is one reason the DEBUG trap exists, and
extended debug mode uses it. Might want to do this only in Posix
modeThe changes have been introduced by the following discussion In the discussion, the POSIX is quoted:
The interpretation of this part "When $ test_command='f1() { false; return; }; f2() { f1 && echo XXX; }; trap f2 WINCH; kill -WINCH 0'
$ mksh -c "$test_command"
unexpected
$ ksh -c "$test_command"
unexpected
$ yash -c "$test_command"
unexpected
$ ash -c "$test_command"
$ dash -c "$test_command"
$ zsh -c "$test_command"
$ busybox sh -c "$test_command"
$ posh -c "${test_command//WINCH/INT}"
$ |
|
Do you know that you are in fact awesome? |
I don't know why the POSIX defines the behavior of I think I'm going to report it in |
|
|
|
Thank you very much for all your report and testing! |
ble version: 0.4.0-devel2+5327f5d
Bash version: 5.0.16(1)-release,x86_64-apple-darwin19.3.0
If I resize a terminal window without typing at least one character into it, the shell won't accept any commands after the resize. The corresponding
bashprocess runs at 100% CPU usage and is only killable by SIGKILL(9). This is independent of the used terminal emulator.How to reporoduce:
PS1:
\[\]\[\033]0;\u@\H:\W\007\]\[$(iterm2_prompt_mark)\]\$ \[\]The text was updated successfully, but these errors were encountered: