about summary refs log tree commit diff
path: root/Functions/Zle/keymap+widget
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-09-27 13:28:01 +0200
committerromkatv <roman.perepelitsa@gmail.com>2019-10-04 14:18:18 +0200
commit243e46998eb29665ec345e531b2d1bb6921ed578 (patch)
tree3156f19a5a0bff701d328a67c403839e0f673aae /Functions/Zle/keymap+widget
parentdca638e3011eb53e7cad054d1886eb65b9e882de (diff)
downloadzsh-243e46998eb29665ec345e531b2d1bb6921ed578.tar.gz
zsh-243e46998eb29665ec345e531b2d1bb6921ed578.tar.xz
zsh-243e46998eb29665ec345e531b2d1bb6921ed578.zip
bug fix: infinite loop when tty disappears
When TTY disappears and there is at least one fd watcher, raw_getbyte() can
enter an infinite loop where it keeps calling poll() over and over again.

To reproduce, open a terminal, start zsh and type this:

  rm -f /tmp/fifo
  mkfifo /tmp/fifo
  exec 3<>/tmp/fifo
  do-nothing() {}
  zle -F 3 do-nothing

Then make TTY disappear. For example, kill the parent with `kill -9 $PPID`
and close the terminal window if it's still there. Observe that zsh is
consiming 100% CPU. Note that do-nothing() never gets called.

This patch makes the poll() loop in raw_getbyte() terminate when TTY is
signalling POLLHUP. This makes the behavior consistent with the case where
TTY disappears while no fd watchers are installed.
Diffstat (limited to 'Functions/Zle/keymap+widget')
0 files changed, 0 insertions, 0 deletions