Bug 166318 - Contradicting information in crontab(5) and cron(8) about DST
Summary: Contradicting information in crontab(5) and cron(8) about DST
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Glen Barber
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-22 14:10 UTC by Florian k Unglaub
Modified: 2012-05-05 04:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian k Unglaub 2012-03-22 14:10:13 UTC
The crontab(5) man page clearly states that jobs scheduled in the lost hour from winter to summer time are lost and are executed twice in the summer to winter transition. 


BUGS
     If you are in one of the 70-odd countries that observe Daylight Savings
     Time, jobs scheduled during the rollback or advance will be affected.  In
     general, it is not a good idea to schedule jobs during this period.
     
     For US timezones (except parts of IN, AZ, and HI) the time shift occurs
     at 2AM local time.  For others, the output of the zdump(8) program's ver?
     bose (-v) option can be used to determine the moment of time shift.


However, cron(8) states that jobs scheduled between 2AM and 3AM are executed correctly if cron is started with the "-s" switch (which is the default).

Relevant parts from cron(8):


     -s      Enable special handling of situations when the GMT offset of the
             local timezone changes, such as the switches between the standard
             time and daylight saving time.

             The jobs run during the GMT offset changes time as intuitively
             expected.  If a job falls into a time interval that disappears
             (for example, during the switch from standard time) to daylight
             saving time or is duplicated (for example, during the reverse
             switch), then it is handled in one of two ways:

             The first case is for the jobs that run every at hour of a time
             interval overlapping with the disappearing or duplicated inter?
             val.  In other words, if the job had run within one hour before
             the GMT offset change (and cron was not restarted nor the
             crontab(5) changed after that) or would run after the change at
             the next hour.  They work as always, skip the skipped time or run
             in the added time as usual.

             The second case is for the jobs that run less frequently.  They
             are executed exactly once, they are not skipped nor executed
             twice (unless cron is restarted or the user's crontab(5) is
             changed during such a time interval).  If an interval disappears
             due to the GMT offset change, such jobs are executed at the same
             absolute point of time as they would be in the old time zone.
             For example, if exactly one hour disappears, this point would be
             during the next hour at the first minute that is specified for
             them in crontab(5).

/usr/src/usr.sbin/cron/cron.c states clearly in lines 210 ff. that the behaviour follows the cron(8) description.

Fix: 

Remove the BUGS section in crontab(5)
Comment 1 Glen Barber freebsd_committer freebsd_triage 2012-04-28 23:48:03 UTC
State Changed
From-To: open->patched

A change has been committed to address this issue. 

Rather than removing the BUGS section entirely, I reworded 
the document to mention that disabling '-s' (which is 
enabled by default) may cause a problem with jobs scheduled 
when the time changes. 

MFC pending. 



Comment 2 Glen Barber freebsd_committer freebsd_triage 2012-04-28 23:48:03 UTC
Responsible Changed
From-To: freebsd-doc->gjb

I committed a fix.
Comment 3 dfilter service freebsd_committer freebsd_triage 2012-04-28 23:48:14 UTC
Author: gjb (doc committer)
Date: Sat Apr 28 22:48:00 2012
New Revision: 234775
URL: http://svn.freebsd.org/changeset/base/234775

Log:
  As cron(8) is started with '-s' by default, timezones that observe
  DST should not need to worry about scheduling jobs when the DST time
  changes.
  
  Rather than removing the BUGS section in crontab(5) regarding this,
  note that disabling '-s' may still cause jobs to be executed twice or
  not at all.
  
  PR:		166318
  Submitted by:	Florian k Unglaub (f.unglaub%googlemail!com)
  MFC After:	1 week

Modified:
  head/usr.sbin/cron/crontab/crontab.5

Modified: head/usr.sbin/cron/crontab/crontab.5
==============================================================================
--- head/usr.sbin/cron/crontab/crontab.5	Sat Apr 28 22:03:19 2012	(r234774)
+++ head/usr.sbin/cron/crontab/crontab.5	Sat Apr 28 22:48:00 2012	(r234775)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 28, 2012
+.Dd April 28, 2012
 .Dt CRONTAB 5
 .Os
 .Sh NAME
@@ -296,10 +296,21 @@ are extensions.
 .An Paul Vixie Aq paul@vix.com
 .Sh BUGS
 If you are in one of the 70-odd countries that observe Daylight
-Savings Time, jobs scheduled during the rollback or advance will be
-affected.
+Savings Time, jobs scheduled during the rollback or advance may be
+affected if
+.Xr cron 8
+is not started with the
+.Fl s
+flag.
 In general, it is not a good idea to schedule jobs during
-this period.
+this period if
+.Xr cron 8
+is not started with the
+.Fl s
+flag, which is enabled by default.
+See
+.Xr cron 8
+for more details.
 .Pp
 For US timezones (except parts of AZ and HI) the time shift occurs at
 2AM local time.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 dfilter service freebsd_committer freebsd_triage 2012-05-05 03:52:55 UTC
Author: gjb (doc committer)
Date: Sat May  5 02:52:41 2012
New Revision: 235047
URL: http://svn.freebsd.org/changeset/base/235047

Log:
  MFC r234775:
  
  As cron(8) is started with '-s' by default, timezones that observe
  DST should not need to worry about scheduling jobs when the DST time
  changes.
  
  Rather than removing the BUGS section in crontab(5) regarding this,
  note that disabling '-s' may still cause jobs to be executed twice or
  not at all.
  
  PR:		166318

Modified:
  stable/9/usr.sbin/cron/crontab/crontab.5
Directory Properties:
  stable/9/usr.sbin/cron/crontab/   (props changed)

Modified: stable/9/usr.sbin/cron/crontab/crontab.5
==============================================================================
--- stable/9/usr.sbin/cron/crontab/crontab.5	Sat May  5 00:30:43 2012	(r235046)
+++ stable/9/usr.sbin/cron/crontab/crontab.5	Sat May  5 02:52:41 2012	(r235047)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 28, 2012
+.Dd April 28, 2012
 .Dt CRONTAB 5
 .Os
 .Sh NAME
@@ -296,10 +296,21 @@ are extensions.
 .An Paul Vixie Aq paul@vix.com
 .Sh BUGS
 If you are in one of the 70-odd countries that observe Daylight
-Savings Time, jobs scheduled during the rollback or advance will be
-affected.
+Savings Time, jobs scheduled during the rollback or advance may be
+affected if
+.Xr cron 8
+is not started with the
+.Fl s
+flag.
 In general, it is not a good idea to schedule jobs during
-this period.
+this period if
+.Xr cron 8
+is not started with the
+.Fl s
+flag, which is enabled by default.
+See
+.Xr cron 8
+for more details.
 .Pp
 For US timezones (except parts of AZ and HI) the time shift occurs at
 2AM local time.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 5 dfilter service freebsd_committer freebsd_triage 2012-05-05 03:53:21 UTC
Author: gjb (doc committer)
Date: Sat May  5 02:53:02 2012
New Revision: 235048
URL: http://svn.freebsd.org/changeset/base/235048

Log:
  MFC r234775:
  
  As cron(8) is started with '-s' by default, timezones that observe
  DST should not need to worry about scheduling jobs when the DST time
  changes.
  
  Rather than removing the BUGS section in crontab(5) regarding this,
  note that disabling '-s' may still cause jobs to be executed twice or
  not at all.
  
  PR:		166318

Modified:
  stable/8/usr.sbin/cron/crontab/crontab.5
Directory Properties:
  stable/8/usr.sbin/cron/crontab/   (props changed)

Modified: stable/8/usr.sbin/cron/crontab/crontab.5
==============================================================================
--- stable/8/usr.sbin/cron/crontab/crontab.5	Sat May  5 02:52:41 2012	(r235047)
+++ stable/8/usr.sbin/cron/crontab/crontab.5	Sat May  5 02:53:02 2012	(r235048)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 28, 2012
+.Dd April 28, 2012
 .Dt CRONTAB 5
 .Os
 .Sh NAME
@@ -296,10 +296,21 @@ are extensions.
 .An Paul Vixie Aq paul@vix.com
 .Sh BUGS
 If you are in one of the 70-odd countries that observe Daylight
-Savings Time, jobs scheduled during the rollback or advance will be
-affected.
+Savings Time, jobs scheduled during the rollback or advance may be
+affected if
+.Xr cron 8
+is not started with the
+.Fl s
+flag.
 In general, it is not a good idea to schedule jobs during
-this period.
+this period if
+.Xr cron 8
+is not started with the
+.Fl s
+flag, which is enabled by default.
+See
+.Xr cron 8
+for more details.
 .Pp
 For US timezones (except parts of AZ and HI) the time shift occurs at
 2AM local time.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 6 dfilter service freebsd_committer freebsd_triage 2012-05-05 03:53:27 UTC
Author: gjb (doc committer)
Date: Sat May  5 02:53:19 2012
New Revision: 235049
URL: http://svn.freebsd.org/changeset/base/235049

Log:
  MFC r234775:
  
  As cron(8) is started with '-s' by default, timezones that observe
  DST should not need to worry about scheduling jobs when the DST time
  changes.
  
  Rather than removing the BUGS section in crontab(5) regarding this,
  note that disabling '-s' may still cause jobs to be executed twice or
  not at all.
  
  PR:		166318

Modified:
  stable/7/usr.sbin/cron/crontab/crontab.5
Directory Properties:
  stable/7/usr.sbin/cron/crontab/   (props changed)

Modified: stable/7/usr.sbin/cron/crontab/crontab.5
==============================================================================
--- stable/7/usr.sbin/cron/crontab/crontab.5	Sat May  5 02:53:02 2012	(r235048)
+++ stable/7/usr.sbin/cron/crontab/crontab.5	Sat May  5 02:53:19 2012	(r235049)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 28, 2012
+.Dd April 28, 2012
 .Dt CRONTAB 5
 .Os
 .Sh NAME
@@ -296,10 +296,21 @@ are extensions.
 .An Paul Vixie Aq paul@vix.com
 .Sh BUGS
 If you are in one of the 70-odd countries that observe Daylight
-Savings Time, jobs scheduled during the rollback or advance will be
-affected.
+Savings Time, jobs scheduled during the rollback or advance may be
+affected if
+.Xr cron 8
+is not started with the
+.Fl s
+flag.
 In general, it is not a good idea to schedule jobs during
-this period.
+this period if
+.Xr cron 8
+is not started with the
+.Fl s
+flag, which is enabled by default.
+See
+.Xr cron 8
+for more details.
 .Pp
 For US timezones (except parts of AZ and HI) the time shift occurs at
 2AM local time.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 7 Glen Barber freebsd_committer freebsd_triage 2012-05-05 03:53:35 UTC
State Changed
From-To: patched->closed

MFC complete.