1. Run `zsh`
2. Run `vim` and hit Control-Z to stop it
3. Enter `fg` to restore the stopped job
I expect `fg` to always be able to restore a stopped `vim`. Instead, sometimes `vim` stops itself again immediately after entering `fg`. The problem seems to be timing or scheduling related because it doesn't always occur.
This is due to a known bug in zsh versions 5.7, 5.7.1, 5.8, and 5.8.1. It was reported to the zsh project by Erik Paulson in June 2021, who also provided a one-line fix. The zsh project accepted Paulson's fix, which is now available in zsh 5.9.
The bug causes zsh to sometimes send two SIGCONT signals to the stopped job instead of only one. Certain programs behave unexpectedly when processing the second SIGCONT. `vim` stops itself. According to Paulson's bug report, `emacsclient` crashes.
Description: Ubuntu 22.04.1 LTS
Release: 22.04
zsh: mirrors. digitalocean. com/ubuntu jammy/main amd64 Packages dpkg/status
Installed: 5.8.1-1
Candidate: 5.8.1-1
Version table:
*** 5.8.1-1 500
500 http://
100 /var/lib/
To reproduce the problem:
1. Run `zsh`
2. Run `vim` and hit Control-Z to stop it
3. Enter `fg` to restore the stopped job
I expect `fg` to always be able to restore a stopped `vim`. Instead, sometimes `vim` stops itself again immediately after entering `fg`. The problem seems to be timing or scheduling related because it doesn't always occur.
This is due to a known bug in zsh versions 5.7, 5.7.1, 5.8, and 5.8.1. It was reported to the zsh project by Erik Paulson in June 2021, who also provided a one-line fix. The zsh project accepted Paulson's fix, which is now available in zsh 5.9.
The bug causes zsh to sometimes send two SIGCONT signals to the stopped job instead of only one. Certain programs behave unexpectedly when processing the second SIGCONT. `vim` stops itself. According to Paulson's bug report, `emacsclient` crashes.
Paulson's original bug report with patch: /www.zsh. org/mla/ workers/ 2021/msg01255. html
https:/
The git commit that introduced the bug in Sept 2018: /github. com/zsh- users/zsh/ commit/ 0a20f4e5a64106d 1793dd44d2fa011 3417225d0f
https:/
The git commit of Paulson's fix: /github. com/zsh- users/zsh/ commit/ f8ec33c453159ad 848d9b1a28782c5 df7f0cc944
https:/
The test program in this Stack Overflow question is a good way to reproduce the problem. With this program it is easy to see the two SIGCONT signals being sent sometimes by zsh fg: /stackoverflow. com/questions/ 64531411/ why-do- i-receive- two-sigcont- signals
https:/
ProblemType: Bug ature: Ubuntu 5.15.0- 46.49-generic 5.15.39 esult: unknown xterm-256color DIR=<set>
DistroRelease: Ubuntu 22.04
Package: zsh 5.8.1-1
ProcVersionSign
Uname: Linux 5.15.0-46-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckR
Date: Sun Aug 28 14:06:07 2022
ProcEnviron:
TERM=screen.
PATH=(custom, no user)
XDG_RUNTIME_
LANG=C.UTF-8
SHELL=zsh
SourcePackage: zsh
UpgradeStatus: No upgrade log present (probably fresh install)