Comment 0 for bug 1987991

Revision history for this message
Matt Day (fjarlq) wrote :

Description: Ubuntu 22.04.1 LTS
Release: 22.04

zsh:
  Installed: 5.8.1-1
  Candidate: 5.8.1-1
  Version table:
 *** 5.8.1-1 500
        500 http://mirrors.digitalocean.com/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

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:
https://www.zsh.org/mla/workers/2021/msg01255.html

The git commit that introduced the bug in Sept 2018:
https://github.com/zsh-users/zsh/commit/0a20f4e5a64106d1793dd44d2fa0113417225d0f

The git commit of Paulson's fix:
https://github.com/zsh-users/zsh/commit/f8ec33c453159ad848d9b1a28782c5df7f0cc944

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:
https://stackoverflow.com/questions/64531411/why-do-i-receive-two-sigcont-signals

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: zsh 5.8.1-1
ProcVersionSignature: Ubuntu 5.15.0-46.49-generic 5.15.39
Uname: Linux 5.15.0-46-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Sun Aug 28 14:06:07 2022
ProcEnviron:
 TERM=screen.xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=C.UTF-8
 SHELL=zsh
SourcePackage: zsh
UpgradeStatus: No upgrade log present (probably fresh install)