Bug 784 - sudo returns exit code 0 after process is killed with SIGTERM
sudo returns exit code 0 after process is killed with SIGTERM
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.16
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-26 17:46 MDT by Timothy Palpant
Modified: 2017-05-10 10:34 MDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Palpant 2017-04-26 17:46:55 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
Comment 1 Todd C. Miller 2017-04-26 20:18:36 MDT
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.
Comment 2 Todd C. Miller 2017-05-10 10:34:21 MDT
Fixed in sudo 1.8.20, available now.