Bugzilla – Bug 784
sudo returns exit code 0 after process is killed with SIGTERM
Last modified: 2017-05-10 10:34:21 MDT
I've noticed that sudo returns 0, not the exit value of the command, if the process being run is killed by SIGTERM. A minimal example is: $ sleep 300; echo $? Terminated 143 $ sudo sleep 300; echo $? 0 where each of these is killed by running `sudo pkill sleep` in another terminal. This behavior seems to have changed since sudo 1.8.3 on Ubuntu 12.04, which prints 143 in both cases. Is this expected behavior? It is difficult to discern if the underlying process was terminated prematurely. $ sudo --version Sudo version 1.8.16 Sudoers policy plugin version 1.8.16 Sudoers file grammar version 45 Sudoers I/O plugin version 1.8.16 $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS" $ uname -a Linux palpant-dbx 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Yes, that's a bug, it was introduced by the fix for bug #722. This is fixed by https://www.sudo.ws/repos/sudo/rev/50b988d0c97f The fix will be included in sudo 1.8.20.
Fixed in sudo 1.8.20, available now.