Hi Simon,

On Tue, Apr 07, 2009 at 05:32:50PM +0100, Simon Waters wrote:
> Package: apticron
> Version: 1.1.27
> Severity: normal
> 
> 
> On the transition to daylight saving received an email from cron:
> 
> /etc/cron.daily/apticron:
> date: invalid date `1:32'
> run-parts: /etc/cron.daily/apticron exited with return code 1
> 
> If the "--cron" argument is specified, then it attempts to read date/time from
> /etc/cron.d/apticron and passes this to the date command.
> 
> However on the date in question the time "1:32" doesn't exist due to 
> transition to 
> daylight saving (British Summer Time) when clock are advanced from 01:00 to 
> 02:00, so "date" gives an
> error and so (due to bash -e) the script exits.

Right. This is a real bug. Thanks for reporting.
 
> Suggest not doing the calculation in bash at all, just touch the file, and 
> let the "find" command
> work out if that was one day ago. Worst that will happen is that on days 
> where apticron --cron
> is run twice it may not run if the next cron is within 24 hours. Whereas here 
> I think it did not run for 48 hours.

Sorry, but I didn't understand what you mean here. You suggest me just touching
the file and keeping the find doing what it currently does. Ok, but the problem
persists, once the date/time in /etc/cron.d/apticron can be one between a
date/time transition. Please could you explain again? I'm not native english so
maybe it's my fault in not getting the point here.

 
>                 time=$( grep -v '^[[:space:]]*\(\#\|$\)' /etc/cron.d/apticron 
> \
>                         2>/dev/null | {
>                         read min hour null
>                         if isDigit "$hour" && isDigit "$min" ; then
>                                 echo "$hour:$min"
>                         fi
>                         } )
> 
>                 if [ "$time" ] ; then
>                         datecron=$( date -d "$time" +%s )

You copied/pasted this code block above but I don't know what you intend.

At the first look I would just ignore the shell return by adding "|| true"
after the lines containing the "date" call. So the "touch" command would try to
touch the stamp file with a invalid date, that could also return true. I guess
the worst case here would be a 48 hours without apticron checking.

I image a better solution would be recalculating the date adding 1 or 2 hours
more to datecron var for this specific case - when, due to the time transition,
we get a invalid date. What do you think?

Regards,

-- 
Tiago Bortoletto Vaz
http://tiagovaz.org
0xA504FECA - http://pgp.mit.edu
GNU/Linux user #188687

Attachment: signature.asc
Description: Digital signature

Reply via email to