Date::Manip changed in 10.04/Lucid

Bug #574116 reported by Greg L
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MythTV
Fix Released
Unknown
Mythbuntu
Expired
Low
Unassigned
libdate-manip-perl (Ubuntu)
Won't Fix
High
Unassigned
mythplugins (Ubuntu)
Fix Committed
Low
Unassigned

Bug Description

Hi,

I'm finding that mythweather only updates the first time I check it. For subsequent checks on the same day, it only uses the cached value. I've determined that the problem is that the envcan.pl script for Canada isn't calculating today's time properly, but I don't know perl, and I can't figure out how to fix it.

Further details:

The script command my frontend calls is:

"nice /usr/share/mythtv/mythweather/scripts/ca_envcan/envcan.pl -u SI -d /home/greg/.mythtv/MythWeather/ENVCAN on-118"

which runs without errors. However, when you look in the file it creates, it says

2010-05-02T00:15:00 2010-05-02T00:00:00
%results = ('pressure' => '1003','visibility' => '24.1','copyright' => 'Copy$ ...

The first date/time on the first line is supposed to be the time of the next update. The second date/time is supposed to be the current date/time. If the current time is less than the next update time, the script uses the cached values. However, the script always thinks it is midnight, so it uses the cached value since midnight is before 00:15. Once you reach the next day, the date changes, and it allows another update.

I'm running Mythbuntu 10.04 with all the updates applied. The version of mythweather I'm using is 0.23.0+fixes24269-0ubuntu0+mythbuntu2.

Revision history for this message
Greg L (gletal) wrote :

I think the problem might be with perl, not with the mythweather script. I made a short script copied off the web:

#!/usr/bin/perl
use Date::Manip;
print &UnixDate("today","It is now %T on %b %e, %Y.\n");

and when run, it gives:

It is now 00:00:00 on May 3, 2010.

So, the script thinks it is midnight, even though it isn't. Any suggestions?

Thanks

Revision history for this message
Greg L (gletal) wrote :

I've worked out a fix. There appears to be an issue with the perl date:manip package when parsing "today". (I'm using date::manip version 6.05- the version included with Mythbuntu 10.04. I haven't tried a newer version because I didn't wish to risk breaking something else). The fix is to edit the envcan.pl script. First add a new variable that stores today's date and time and put it in the correct format:

    my $date=localtime(time);
    $date=UnixDate($date, " %O \n");

(I put this near the top after the other variable definitions)

Then replace wherever it says "today" with the new variable $date.

There might be a better way, but this is the first time I've edited a perl script, and this appears to work.

Thanks

MarcRandolph (mrand)
summary: - Mythweather only updates once a day
+ UnixDate broken in Date::Manip in Lucid
tags: added: regression-release
Revision history for this message
MarcRandolph (mrand) wrote : Re: UnixDate broken in Date::Manip in Lucid

Thank you for helping to improve Ubuntu by opening this ticket. I'm marking this ticket as high because of the potential widespread chaos it could cause across a wide range of possible applications. And that's even ignoring that 10.04 is an LTS.

Using your short script, I verified that the correct date is provided by 9.10, which uses libdate-manip-perl (5.54-1) rather than 6.05-1. I see some comments in the 6.07-2 notes that hint at fixing a similar problem.

Changed in mythbuntu:
importance: Undecided → High
status: New → Triaged
importance: High → Low
Changed in libdate-manip-perl (Ubuntu):
importance: Undecided → High
status: New → Triaged
summary: - UnixDate broken in Date::Manip in Lucid
+ UnixDate broken in Date::Manip in 10.04/Lucid
Revision history for this message
MarcRandolph (mrand) wrote : Re: UnixDate broken in Date::Manip in 10.04/Lucid

Heh. The very next bug in my bug mail could probably be solved by fixing this bug:
https://bugs.launchpad.net/bugs/544522

I'm guessing there are numerous others, probably more serious and as-yet-undiscovered ones. This could affect all sorts of reports and/or mission critical applications that businesses run on their stable servers.

Similar, but not quite identical upstream bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=577950

Revision history for this message
MarcRandolph (mrand) wrote :

Verified that this is NOT fixed in libdate-manip-perl 6.07-2 in ubuntu in maverick

Revision history for this message
MarcRandolph (mrand) wrote :

Developers response from https://rt.cpan.org/Public/Bug/Display.html?id=57513

If you change the word 'today' to 'now', it will work.

From the Changes5to6 manual:

The words "today", "tomorrow", and "yesterday" in 5.xx referred to the
time now, 24 hours in the future, and 24 hours in the past respectively.

As of 6.00, these are treated strictly as date strings, so they are the
current day, the day before, or the day after at the time 00:00:00.

The string "now" still refers to the current date and time.

Changed in libdate-manip-perl (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
MarcRandolph (mrand) wrote :

Looks like this would affect US and Canada. I've attached a patch to the upstream ticket, if anyone is interested in manually applying it. Or you can wait for it to feed through auto-builds.

summary: - UnixDate broken in Date::Manip in 10.04/Lucid
+ Date::Manip changed in 10.04/Lucid
Changed in mythtv (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Changed in mythtv:
status: Unknown → New
Changed in mythtv:
status: New → Fix Released
Revision history for this message
Mario Limonciello (superm1) wrote :

According to http://svn.mythtv.org/trac/ticket/8466, the patch has been released to the current trunk version, so i'm going to mark this fix committed. It hasn't yet been added to 0.23-fixes however.

affects: mythtv (Ubuntu) → mythplugins (Ubuntu)
Changed in mythplugins (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Thomas Mashos (tgm4883) wrote :

We really do appreciate you opening this ticket to help improve Mythbuntu, but it needs to be closed for a number of reasons. The biggest one is that upstream has moved on to a new version and believes this to be fixed. Could you please verify if this issue still exists in the latest version?

Please do not let the closing of this ticket dissuade you from opening a new ticket if this (or any other) problem occurs with the newer versions.

Changed in mythbuntu:
status: Triaged → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.