Bug 154065 - control not returned to stopped job when fg issued
control not returned to stopped job when fg issued
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: vixie-cron (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
Brock Organ
Depends On:
Blocks: 170785
  Show dependency treegraph
Reported: 2005-04-06 19:04 EDT by Stephen Gardner
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version: vixie-cron-4.1-36.EL4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-05-01 13:44:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Stephen Gardner 2005-04-06 19:04:52 EDT
[ NOTE: this may be an issue with  vi  or  crontab  as I have only found one
method of invoking this problem currently which involves using those commands ]

Description of problem:

Version-Release number of selected component (if applicable):
RHEL4-AS-U0 (i386 and x86_64)

How reproducible:
Always (as root and non-root user)

Steps to Reproduce:
1. crontab -e
2. Press  Control-Z  (receive   "[1]+  Stopped crontab -e"  output)
3. fg  (or fg %1)
4a. Press  enter   (you should find you are still at the command prompt)
4b. fg   again to get back into  crontab  editor (vi)

[ this can be reproduced if others backgrounded running / stopped jobs exist ]

Actual results:
User is left at command problem unexpectedly and has to foreground crontab twice.

Expected results:
User is returned to previously stopped program

Additional info:
This does not happen on RHEL3-U4 where control is returned to crontab as expected.
Comment 1 Stephen Gardner 2005-04-07 09:47:40 EDT
This problem also occurs on Fedora RAWHIDE (sync'd 7 April 2005) with
Comment 2 Tim Waugh 2005-04-07 09:52:14 EDT
I can reproduce the problem on Red Hat Enterprise Linux 4.  Replacing the bash
package with the one for RHEL3-U4 (bash-2.05b-29.0.3) does *not* make the
problem go away.

Concluding that vixie-cron is at fault and setting component.
Comment 3 Jason Vas Dias 2005-04-07 14:02:05 EDT
Yes, this is a problem - I've duplicated it with vixie-cron-4.1 on FC4 & FC3.

It seems vixie-cron-4.1's crontab is being over-zealous in using:
    waitpid(child, &exit_status, WUNTRACED)
which returns when child gets a SIGSTOP (when not under trace)
whereas vixie-cron-3.0.1 just uses
which does not return on a SIGSTOP sent to the child.

Even worse, vixie-cron-4.1 crontab reacts to the exit status WIFSTOPPED
by killing itself with SIGSTOP, depending on itself getting a SIGCONT
when vi gets a SIGCONT; but there are problems in the kernel with 
propagating SIGCONT from child to parent. So the first SIGCONT 
resumes vi which displays its screen, but as the SIGCONT is not
propagated, crontab is still stopped, and as the child of a stopped
process group, vi goes into the background again. It is necessary
to send SIGCONT again to the process group leader (crontab) to put
vi into the foreground again.

I can't understand why this change to kill itself with SIGSTOP 
when the editor child is stopped was made in vixie-cron-4.1 and I'm
backing it out.

This issue is now fixed with vixie-cron-4.1-30_EL, which should be
in RHEL-4-U2. Meanwhile, you can download it from:

Comment 4 Stephen Gardner 2005-04-07 14:45:23 EDT
Jason, thank you for the speedy resolution and in particular for the detailed
explanation of the signal handling propagation issue which caused it to occur. I
have confirmed the -30 release you provided works as expected on RHEL4-U0 i386
and x86_86.

Note You need to log in before you can comment on or make changes to this bug.