Bug 644 - suspend fg resume not working
suspend fg resume not working
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.9
Other Other
: low high
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-28 06:56 MDT by Brian Pribis
Modified: 2014-05-07 13:25 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Pribis 2014-04-28 06:56:13 MDT
Working on Ubuntu 14.04 on AWS's EC2.

We were on 12.04 and things worked fine until upgrading to 14.04.

It would appear that the fg bug that was fixed in 1.8.1 has been reintroduced.  

The fix description was: "The fix for resuming a suspended shell in 1.7.5 caused problems with resuming non-shells on Linux. Sudo will now save the process group ID of the program it is running on suspend and restore it when resuming, which fixes both problems."

On the current version (1.8.9p5):
1. Start emacs (or vim) with sudo
2. Ctl-Z
3. fg

You may have to repeat a few times to get it to happen.  When it does the suspended program will not return to the fg.  If you execute fg one more time it will come to the foreground but you won't be able to interact with it on any meaningful level.  kill'ing the process is the only way out.

This is happening on all three ubuntu machines we upgraded.
Comment 1 Brian Pribis 2014-04-28 07:46:02 MDT
This may be unrelated, but I thought I'd add it anyway. When fg fails, my number pad stops working correctly (acts like it may be enabled in mouse mode or something).  But if I open another file (say, using emacs) and exit, the number pad starts working correctly. 

1. Open file with sudo emacs
2. Ctl-Z
3. fg 
4. Repeat 1-3 until fg fails to bring emacs to foreground.
5. Numpad not working.
6. Open another file with emacs (doesn't have to be sudo'd).
7. Exit emacs (or send to background).
8. Numpad working now.
Comment 2 Brian Pribis 2014-04-28 08:27:11 MDT
I compiled and installed from src 1.8.10p2 and the problem appears to have gone away.

Can anyone confirm this? 

Ubuntu doesn't have this version yet available.
Comment 3 Todd C. Miller 2014-04-28 08:51:39 MDT
I'm currently traveling and won't be able to try to reproduce the problem on Ubuntu 14.04 until the end of the week.  Thanks for trying out 1.8.10p2, I was going to ask if you could do that. There was a change in 1.8.10 that affects how the terminal mode is restored which might be relevant.
Comment 4 Brian Pribis 2014-04-28 11:30:18 MDT
Just to note, 1.8.10p2 also fixed the numpad problem as well.
Comment 5 Todd C. Miller 2014-05-07 13:25:02 MDT
I'm going to mark this as fixed as I am unable to reproduce the problem with Ubuntu 14.04 using either the Ubuntu 1.8.9p5 package or 1.8.10p2 from sudo.ws.

This kind of race condition can be hard to reproduce and may depend on the number of CPUs and how busy the system is.  Since you can no longer reproduce the problem it seems likely that the changeset that fixed it was  http://www.sudo.ws/repos/sudo/rev/94979d51daa2