Bug 221856

Summary: Cron does not detect changed symlink
Product: Red Hat Enterprise Linux 4 Reporter: Jose Plans <jplans>
Component: vixie-cronAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED ERRATA QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0685 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-02 08:06:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 225078, 253391    
Attachments:
Description Flags
Patch fixing the problem. none

Description Jose Plans 2007-01-08 16:10:22 UTC
Ok so summary and explanations.
 
 * Reproducer:
  a) create two crontab files in /tmp
     /tmp/cron_a : * * * * * root /bin/date
     /tmp/cron_b : * * * * * root /bin/ls /tmp
     
  b) symlink cron_a to an intermediate symlink  
     % ln -s /tmp/cron_a /tmp/cron_symlink
     
  c) symlink this intermediate one to the cron.d directory
     % ln -s /tmp/cron_symlink /etc/cron.d/test
     
  d) Restart crond.
  e) Everything works as expected.
  f) Delete the intermediate symlink so we can add the other cron_b instead.
     % rm /tmp/cron_symlink
     
  g) symlink cron_b now to the intermediate
     % ln -s /tmp/cron_b /tmp/cron_symlink
     
  h) *DO NOT* restart just reload, nothing happens.
   
Ok vixie-cron is not well aware of symlinks, it doesn't know if we changed or
not a symbolic link; however everything is in place to reload stuff as the
signal is monitored and there is a sa_handler updating a volatile flag.

Now, the solution to this problem would be to just reload the database when
SIGHUP is send and/or, in other words, we did service crond reload. 
However, since the database is only checked when the modified time changed on
the directory /etc/cron.d, we miss the tick.. The solution then is to reset
m_time so we are sure this happens on SIGHUP.

This happens with all vixie-cron 4.1-xxx
Marcela, this also goes on FedoraCore and RHEL5, let me know if you want me to
clone the bug or you need anything else.

Also the patch has been tested succesful.

     Jose

Comment 1 Jose Plans 2007-01-08 16:10:23 UTC
Created attachment 145065 [details]
Patch fixing the problem.

Comment 3 Marcela Mašláňová 2007-01-12 17:22:00 UTC
Hello Jose,
I appreciate your patch. Thank you. 

I'll update Fedora later with some other patches. For RHEL5 I opened bugzilla
#222461.

Comment 9 Marcela Mašláňová 2007-07-10 16:32:30 UTC
*** Bug 225078 has been marked as a duplicate of this bug. ***

Comment 13 Red Hat Bugzilla 2007-08-02 08:06:12 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0685.html