Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2000 22:56:56 +0100
From:      Gerhard Sittig <Gerhard.Sittig@gmx.net>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: how to test out cron.c changes? (was: cvs commit: src/etc crontab)
Message-ID:  <20001205225656.Z27042@speedy.gsinet>
In-Reply-To: <20001120193326.C27042@speedy.gsinet>; from Gerhard.Sittig@gmx.net on Mon, Nov 20, 2000 at 07:33:26PM %2B0100
References:  <200011191816.KAA81473@freefall.freebsd.org> <20001119214008.Z27042@speedy.gsinet> <20001120143658.B4415@netmode.ece.ntua.gr> <20001120193326.C27042@speedy.gsinet>

next in thread | previous in thread | raw e-mail | index | archive | help
[ I'm not subscribed to -hackers, please keep CC'ing me; thanks! ]

On Mon, Nov 20, 2000 at 19:33 +0100, Gerhard Sittig wrote:
> 
> [ ... cron and DST ... ]
> 
> But I thought modifying cron(8) itself would be the best way.
> Is someone already working on this or should I try to do it
> myself (within the next few weeks)?

Since I dared to offer my working on cron.c in the above cited
cvs-all message <20001120193326.C27042@speedy.gsinet> and nobody
stopped me :)  I did as sketched here:

$ diff -r -u \
    fbsd/src/usr.sbin/cron/cron \
    obsd/src/usr.sbin/cron \
    > $PATCHFILE
$ $EDITOR $PATCHFILE
$ cd fbsd/src/usr.sbin/cron/cron
$ patch -p4 < $PATCHFILE
$ make all

This took the DST handling code of OpenBSD's cron, leaving the
other diffs / details (capabilities, logging, errno handling, gcc
work arounds, formatting, pipe/env etc stuff) aside.

But what keeps me from feeding the changes back into the FreeBSD
project by means of send-pr(1) is that I don't want to do so
before testing that everything works as it should.  That's where
I fail miserably:

# script
# kill `cat /var/run/cron.pid`
# ./cron -x sch &
... watch it for a while ...
# date -v+1H
... further watch it ...
# echo 'date 0300' | at 0200
... further watch it ...

Normal run is not broken. :)  Small jumps (the first date
command) work as expected.  But the DST emulation (the second
date command, delayed) fails since "something" turns back the
clock some two minutes after the scheduled jump.  And I feel it's
adjkerntz(8) run by cron doing so (scheduled for 03:01:00 by
default).

Remembering the fortune "Don't force it.  Get a larger hammer!"
and after reading "man 5 tzfile; man 8 zic zdump" I applied the
following patch to simulate another DST change:

Index: /usr/src/share/zoneinfo/europe
===================================================================
RCS file: /usr/fcvs/src/share/zoneinfo/europe,v
retrieving revision 1.18.2.2
diff -u -r1.18.2.2 europe
--- /usr/src/share/zoneinfo/europe      2000/10/25 19:44:08     1.18.2.2
+++ /usr/src/share/zoneinfo/europe      2000/12/03 12:36:54
@@ -406,6 +406,10 @@
 Rule   EU      1981    max     -       Mar     lastSun  1:00u  1:00    S
 Rule   EU      1996    max     -       Oct     lastSun  1:00u  0       -

+# this is my private modification to test out DST handling code in cron(8).
+Rule   EU      2000    only    -       Dec      4       1:00u  1:00    S
+Rule   EU      2000    only    -       Dec      5       1:00u  0       -
+
 # W-Eur differs from EU only in that W-Eur uses standard time.
 Rule   W-Eur   1977    1980    -       Apr     Sun>=1   1:00s  1:00    S
 Rule   W-Eur   1977    only    -       Sep     lastSun  1:00s  0       -

After "make buildworld; make installworld; mergemaster; cp
/usr/share/zoneinfo/Europe/Berlin /etc/localtime" (you know,
grabbing the _big_ stick ...) I tried to double check:

$ zdump -v /etc/localtime | grep 2000
/etc/localtime  Sun Mar 26 00:59:59 2000 UTC = Sun Mar 26 01:59:59 2000 CET isdst=0 gmtoff=3600
/etc/localtime  Sun Mar 26 01:00:00 2000 UTC = Sun Mar 26 03:00:00 2000 CEST isdst=1 gmtoff=7200
/etc/localtime  Sun Oct 29 00:59:59 2000 UTC = Sun Oct 29 02:59:59 2000 CEST isdst=1 gmtoff=7200
/etc/localtime  Sun Oct 29 01:00:00 2000 UTC = Sun Oct 29 02:00:00 2000 CET isdst=0 gmtoff=3600
/etc/localtime  Mon Dec  4 00:59:59 2000 UTC = Mon Dec  4 01:59:59 2000 CET isdst=0 gmtoff=3600
/etc/localtime  Mon Dec  4 01:00:00 2000 UTC = Mon Dec  4 03:00:00 2000 CEST isdst=1 gmtoff=7200
/etc/localtime  Tue Dec  5 00:59:59 2000 UTC = Tue Dec  5 02:59:59 2000 CEST isdst=1 gmtoff=7200
/etc/localtime  Tue Dec  5 01:00:00 2000 UTC = Tue Dec  5 02:00:00 2000 CET isdst=0 gmtoff=3600

(Actually this was done in two steps:  First I copied the "EU"
and "Germany" sections from the europe file, inserted the
additional DST switch between 01:00 and 04:00 UTC on an earlier
date, compiled and installed with "zic -d . tzfile; cp CronDST
/etc/localtime", tested with the above zdump command and failed
to get the expected DST messages when running cron, too. :< )

Afterwards I started the test again ("script; kill `cat
/var/run/cron.pid`; ./cron -x sch") and failed to see _any_ "DST"
log messages I've seen before.  Although local time did change
(jump forward for an hour) for this one day.  Hmmm ...


I'm lost.  Please advise on how to best test this scenario.
Without local tests I definitely won't publish the patch (don't
feel at all like bothering others with code which doesn't work in
its basic functionality).

Having the logic in cron itself would eliminate the never ending
discussion bubbling up twice a year on why cronjobs didn't run /
ran multiple times and where to move daily cronjobs to (ending up
every time with the result that _no_ time suits _all_ the FreeBSD
users -- there simply are way too many of them ... :).

Thank you for your attention (and patience to read this lengthy
message)!


virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
Gerhard Sittig   true | mail -s "get gpg key" Gerhard.Sittig@gmx.net
-- 
     If you don't understand or are scared by any of the above
             ask your parents or an adult to help you.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001205225656.Z27042>