Package: at
Version: 3.1.10
Severity: important
I schedule jobs in shell scripts using a syntax like :
at 3:30 tomorrow < ThisScript.sh >/dev/null 2>/dev/null
I noticed that jobs had not been run after 31/12/2007. Doing an 'at -l'
to list the jobs showed that all the jobs had been scheduled for 1 Jan
2009, rather than 1 Jan 2008.
Essentially, running 'at 3:30 tomorrow' (or similar, eg 'at 3:30 next
week') at the end of the year causes an extra year to be added to the
date. It wasn't until today (the 3rd that I've noticed that this was the
case - it could have been a problem for some time otherwise).
Examination of the source in parsetime.y, replacing the :
currtime = time(NULL);
with :
currtime = 1199071800; /* 31st Dec 2007 3:30am */
and removing the 'panic("refusing to create job destined in the past");'
check allowed me to play with the code in order to see the problem.
For example, this works fine :
buttercup:/home/justin/Root/AT/at-3.1.10# ./at -v 4pm
Mon Dec 31 16:00:00 2007
at>
However, this fails badly :
buttercup:/home/justin/Root/AT/at-3.1.10# ./at -v 4pm tomorrow
Thu Jan 1 16:00:00 2009
at>
Looking at the code, there is a check for a year having been specified.
If this is NOT set, and the date given is in the past, the year is
incremented :
else if (!yearspec) {
if ((exectm.tm_mon < currtm.tm_mon) ||
((exectm.tm_mon == currtm.tm_mon &&
exectm.tm_mday < currtm.tm_mday)))
exectm.tm_year++;
}
I /think/ that this yearspec variable should have been set when a
relative date is used. This is, however, just my interpretation of the
problem and it might be far more subtle than that.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-486
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Versions of packages at depends on:
ii libc6 2.3.6.ds1-13etch2 GNU C Library: Shared libraries
ii libpam0g 0.79-4 Pluggable Authentication Modules l
ii lsb-base 3.1-23.2etch1 Linux Standard Base 3.1 init scrip
ii postfix [mail-transpor 2.3.8-2+b1 A high-performance mail transport
at recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]