Bug#916200: script: does not reap signaled children any more, deadlocks until SIGKILL

2018-12-15 Thread Bernhard Übelacker
Control: fixed 916200 1:2.30.2-0.3
Control: found 916200 1:2.31.1-0.1


Dear Maintainer,
I noticed this behaviour too and found last version that
normally exits is 2.30.2.

I did a git bisect that points to the upstream commit [1] below.

Kind regards,
Bernhard


[1] 
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=2e7a92270114cc652ea090251a374e917adb7a72


# git bisect good
2e7a92270114cc652ea090251a374e917adb7a72 is the first bad commit
commit 2e7a92270114cc652ea090251a374e917adb7a72
Author: Karel Zak 
Date:   Fri Sep 8 09:48:29 2017 +0200

script: support sig{stop/cont}

* call wait() only when child exited
* suspend all session (including script master process) when child get
  SIGSTOP and send SIGCONT to child when master process resume

This allows to suspend all session and later use "fg" shell command to
resume.

$ ps af
14722 pts/1Ss 0:00 bash
 4870 pts/1S+ 0:00  \_ ./script
 4871 pts/6Ss+0:00  \_ bash -i

$ kill -SIGSTOP 4871

and script session on another terminal:

$ script
Script started, file is typescript
$ 
[1]+  Stopped ./script

$ fg 1
./script

... session again usable ...
^D
Script done, file is typescript

Signed-off-by: Karel Zak 

:04 04 5f6d5eb332f5db3c41cb095d39efdca5be5baf6e 
cdc08b6da0bc5f5a93be049c1a80f0b0620a9417 M  term-utils



# buster amd64 qemu VM


apt update
apt dist-ugprade
apt build-dep util-linux


apt install bsdutils git


script -c "vi"
kill $(pidof vi)
kill -9 $(pidof script)


wget 
https://snapshot.debian.org/archive/debian/20170322T211511Z/pool/main/u/util-linux/bsdutils_2.29.2-1_amd64.deb
wget 
https://snapshot.debian.org/archive/debian/20180117T154752Z/pool/main/u/util-linux/bsdutils_2.30.2-0.3_amd64.deb
wget 
https://snapshot.debian.org/archive/debian/20180308T040556Z/pool/main/u/util-linux/bsdutils_2.31.1-0.5_amd64.deb
wget 
https://snapshot.debian.org/archive/debian/20180210T101430Z/pool/main/u/util-linux/bsdutils_2.31.1-0.1_amd64.deb



bsdutils  1:2.29.2-1ends
bsdutils  1:2.30.2-0.3  ends
bsdutils  1:2.31.1-0.1  hangs
bsdutils  1:2.31.1-0.5  hangs
bsdutils  1:2.32.1-0.1  hangs



git clone git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
git checkout v2.30.2
./autogen.sh
./configure
make -j8
./script -c "vi"
make clean
git checkout v2.31.1
...



git checkout v2.30.2# ends
git checkout v2.31.1# hangs




root@debian:~/util-linux# git bisect start
root@debian:~/util-linux# git bisect good v2.30.2
root@debian:~/util-linux# git bisect bad v2.31.1
binäre Suche: eine Merge-Basis muss geprüft werden
[dd9bae58ae4bc3bded2acf743981bbc8c06f468a] build-sys: release++ (v2.30)
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 315 Commits zum Testen übrig (ungefähr 8 Schritte)
[5264aebb4f822fa9147ee576562a4961ca97261d] lib/randutils: improve getrandom() 
usage
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 157 Commits zum Testen übrig (ungefähr 7 Schritte)
[6b28328255aa1248931947a4d1521288bde01837] su: properly clear child PID
root@debian:~/util-linux# git bisect bad
binäre Suche: danach noch 71 Commits zum Testen übrig (ungefähr 6 Schritte)
[d17fb726b562a69e8f174d46fa6cf794abc129cd] rfkill: merge rfkill.8 project to 
util-linux
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 35 Commits zum Testen übrig (ungefähr 5 Schritte)
[2e7a92270114cc652ea090251a374e917adb7a72] script: support sig{stop/cont}
root@debian:~/util-linux# git bisect bad
binäre Suche: danach noch 17 Commits zum Testen übrig (ungefähr 4 Schritte)
[24f9dde539777417325d6039e2f2387d792afe96] build-sys: remove unused rfkill.py
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 8 Commits zum Testen übrig (ungefähr 3 Schritte)
[5b8e46f7e7710e2bb88ff8e763997830c9494df2] hwclock: close hwaudit_fd 
unconditionally
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 4 Commits zum Testen übrig (ungefähr 2 Schritte)
[3184afa529de5efc77c4ea1f0574276a6f482f7e] uuidgen: add more details to man page
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 2 Commits zum Testen übrig (ungefähr 1 Schritt)
[08e3c9e6620232aa5433d102d3f8ac28bbae01b0] hwclock: update usage()
root@debian:~/util-linux# git bisect good
binäre Suche: danach noch 0 Commits zum Testen übrig (ungefähr 1 Schritt)
[e12364cdfb2c8046bfe34f18af9583f1dcf934c9] lsblk: small man page change in 
return codes description
root@debian:~/util-linux# git bisect good
2e7a92270114cc652ea090251a374e917adb7a72 is the first bad commit
commit 2e7a92270114cc652ea090251a374e917adb7a72
Author: Karel Zak 
Date:   Fri Sep 8 09:48:29 2017 +0200

script: support sig{stop/cont}

* call wait() only when child exited
* suspend all 

Bug#916200: script: does not reap signaled children any more, deadlocks until SIGKILL

2018-12-11 Thread ydirson
Package: bsdutils
Version: 1:2.32.1-0.1
Severity: important

Since upgrade from stretch to buster, script does not terminate any more when 
the monitored process
gets killed.  The child is left as a zombie, and when sent SITERM or SIGQUIT 
script only prints
"Session terminated." and does not exit.  Only SIGKILL was able to get rid of 
it.

24263 pts/5S+ 0:00  |   |   |   \_ 
script -c vi /etc/passwd
24264 ?Zs 0:00  |   |   |   
\_ [vi] 

Downgrading to stretch's 1:2.29.2-1+deb9u1 gets back to proper behaviour.