NetBSD Problem Report #48648

From www@NetBSD.org  Sun Mar  9 16:35:56 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D395FA4095
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  9 Mar 2014 16:35:56 +0000 (UTC)
Message-Id: <20140309163555.6DD69A5828@mollari.NetBSD.org>
Date: Sun,  9 Mar 2014 16:35:55 +0000 (UTC)
From: dennis.c.ferguson@gmail.com
Reply-To: dennis.c.ferguson@gmail.com
To: gnats-bugs@NetBSD.org
Subject: cron fails to run job scheduled during change to summer time
X-Send-Pr-Version: www-1.0

>Number:         48648
>Category:       bin
>Synopsis:       cron fails to run job scheduled during change to summer time
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 09 16:40:00 +0000 2014
>Originator:     Dennis Ferguson
>Release:        6.99.32
>Organization:
none at all
>Environment:
NetBSD b1.to.mistimed.ca 6.99.32 NetBSD 6.99.32 (GENERIC) #0: Wed Feb 26 03:33:01 EST 2014  root@b1.to.mistimed.ca:/build/amd64/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
The cron(1) man page says this about daylight saving time changes:

     Local time changes of less than three hours, such as those caused by the
     start or end of Daylight Saving Time, are handled specially.  This only
     applies to jobs that run at a specific time and jobs that are run with a
     granularity greater than one hour.  Jobs that run more frequently are
     scheduled normally.

     If time has moved forward, those jobs that would have run in the interval
     that has been skipped will be run immediately.  Conversely, if time has
     moved backward, care is taken to avoid running jobs twice.

This leads me to believe that a daily job scheduled to run in the
hour deleted by a change to summer time should still be run.

I have a machine with this root crontab:

#
SHELL=/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
CRON_WITHIN=7200
#
#minute hour    mday    month   wday    command
#
*/10    *       *       *       *       /usr/libexec/atrun
#
# rotate log files every hour, if necessary
0       *       *       *       *       /usr/bin/newsyslog
#
# do daily/weekly/monthly maintenance
15      1       *       *       *       /bin/sh /etc/daily 2>&1 | tee /var/log/daily.out | sendmail -t
05      2       *       *       6       /bin/sh /etc/weekly 2>&1 | tee /var/log/weekly.out | sendmail -t
#30     5       1       *       *       /bin/sh /etc/monthly 2>&1 | tee /var/log/monthly.out | sendmail -t
50      2       *       *       *       /bin/sh /build/bin/b_autobuild

The job scheduled at 02:50 has run every day at that time
for the last 8 months.  From the cron(1) description I would
have expected this job to run at 03:00 instead, but cron failed
to run the job at all.  Here are the contents of /var/log/cron
across the local time change:

Mar  9 01:40:00 b1 cron[18856]: (root) CMD START (/usr/libexec/atrun)
Mar  9 01:40:00 b1 cron[15325]: (root) CMD FINISH (/usr/libexec/atrun)
Mar  9 01:50:00 b1 cron[7278]: (root) CMD START (/usr/libexec/atrun)
Mar  9 01:50:00 b1 cron[11210]: (root) CMD FINISH (/usr/libexec/atrun)
Mar  9 03:00:00 b1 cron[20942]: (root) CMD START (/usr/bin/newsyslog)
Mar  9 03:00:00 b1 cron[7959]: (root) CMD START (/usr/libexec/atrun)
Mar  9 03:00:00 b1 cron[7397]: (root) CMD FINISH (/usr/libexec/atrun)
Mar  9 03:00:00 b1 cron[26859]: (root) CMD FINISH (/usr/bin/newsyslog)
Mar  9 03:10:00 b1 cron[4584]: (root) CMD START (/usr/libexec/atrun)
Mar  9 03:10:00 b1 cron[12536]: (root) CMD FINISH (/usr/libexec/atrun)

It seems like either cron(1) is broken or its man page is.
>How-To-Repeat:
Schedule a cron job to run in the hour deleted by the change
to summer time?
>Fix:
I briefly looked at the cron implementation but couldn't find
code that looked like it was trying to do what the man page
describes during a time change.  Perhaps it is the man page
that is wrong?

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.