Issue 14476: sudo breaks python (original) (raw)

Issue14476

Created on 2012-04-02 14:57 by ossman, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg157358 - (view) Author: Pierre Ossman (ossman) Date: 2012-04-02 14:57
sudo breaks exception handling in Python in some subtle way. The following test program works fine when run directly, but breaks when run through sudo: #!/usr/bin/python import time def a(): try: while True: time.sleep(0.001) except KeyboardInterrupt: print "a" def b(): try: a() except KeyboardInterrupt: print "b" b() This is expected: pierre@pangolin:~$ ./test.py ^Ca But through sudo you get random behaviour: pierre@pangolin:~$ sudo ./test.py ^Ca b pierre@pangolin:~$ sudo ./test.py ^Ca b pierre@pangolin:~$ sudo ./test.py ^Ca b pierre@pangolin:~$ sudo ./test.py ^Ca pierre@pangolin:~$ sudo ./test.py ^Ca pierre@pangolin:~$ sudo ./test.py ^Cb Seen on Ubuntu 12.04 (alpha/beta) and on Fedora 16. Happens more often on Ubuntu though.
msg157360 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-04-02 15:02
It's probably not related to Python; see http://comments.gmane.org/gmane.comp.tools.sudo.user/3769 This threads ends with: """ Great. That change will be in the next sudo release. """
msg157361 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-02 15:10
See also http://www.gratisoft.us/bugzilla/show_bug.cgi?id=464, which lists versions. Sounds like the same bug Amaury linked to.
msg157362 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-02 15:11
I'm going to close this. If it turns out not to be a bug in sudo, please reopen.
msg157364 - (view) Author: Pierre Ossman (ossman) Date: 2012-04-02 15:15
Well that was fast. :) Sounds very much like the same bug I'm seeing here, yes. Unfortunately I'm not sure it's sufficient for us to rely on the distributions to update their sudo packages. A workaround would be preferable. I'll see if I can figure something out. Many thanks!
History
Date User Action Args
2022-04-11 14:57:28 admin set github: 58681
2012-04-02 15:15:39 ossman set messages: +
2012-04-02 15:11:49 r.david.murray set status: open -> closedresolution: not a bugmessages: + stage: resolved
2012-04-02 15:10:33 r.david.murray set nosy: + r.david.murraymessages: +
2012-04-02 15:02:38 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2012-04-02 14:59:54 tshepang set nosy: + tshepang
2012-04-02 14:57:05 ossman create