Closed Bug 281920 Opened 20 years ago Closed 20 years ago

"Use of uninitialized value in integer addition" on buglist.cgi under IIS

Categories

(Bugzilla :: Query/Bug List, defect)

2.18
x86
Windows XP
defect
Not set
trivial

Tracking

()

RESOLVED INVALID

People

(Reporter: glob, Assigned: glob)

References

Details

There's been quite a few reports of the following being printed on the
buglist.cgi's output:

[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in
integer addition (+) at E:/ActivePerl/lib/Time/Local.pm line 76.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in
integer multiplication (*) at E:/ActivePerl/lib/Time/Local.pm line 76.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in
integer multiplication (*) at E:/ActivePerl/lib/Time/Local.pm line 76.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in pack
at E:/ActivePerl/lib/Time/Local.pm line 67.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in pack
at E:/ActivePerl/lib/Time/Local.pm line 67.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in
integer addition (+) at E:/ActivePerl/lib/Time/Local.pm line 68.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in
integer addition (+) at E:/ActivePerl/lib/Time/Local.pm line 69.
[Fri Feb 11 01:37:31 2005] buglist.cgi: Use of uninitialized value in
integer addition (+) at E:/ActivePerl/lib/Time/Local.pm line 67.
Status: NEW → ASSIGNED
as IIS prints STDERR to STDOUT, instead of an error log, it's a visible bug for
IIS bugzilla installs.

i can't reproduce this on any IIS install i've managed to get my hands on, and i
can't see anything obvious in the code.
progress.  here's a stack dump

Time::Local::_timegm() called at E:/Perl/lib/Time/Local.pm line 90

Time::Local::_zoneadjust(-24856, 74752, -2147483648) called at
E:/Perl/lib/Time/Local.pm line 155

Time::Local::timelocal(33, 36, 21, 11, 1, 105) called at
E:/Perl/site/lib/Date/Format.pm line 232

Date::Format::Generic::format_Z('Date::Format::Generic=ARRAY(0x1de19c4)') called
at E:/Perl/site/lib/Date/Format.pm line 65

Date::Format::Generic::_subs('Date::Format::Generic=ARRAY(0x1de19c4)', '%a %b %e
%T %Z %Y') called at E:/Perl/site/lib/Date/Format.pm line 126

Date::Format::Generic::time2str('Date::Format::Generic', '%a %b %e %T %Z %Y',
1108128993) called at E:/Perl/site/lib/Date/Format.pm line 19

Date::Format::time2str('%a %b %e %T %Z %Y', 1108128993) called at
data\template\template\en\default\list\list.html.tmpl line 83

eval {...} called at data\template\template\en\default\list\list.html.tmpl line 16

Template::Provider::__ANON__('Template::Context=HASH(0x1c001f8)') called at
E:/Perl/site/lib/Template/Document.pm line 140

eval {...} called at E:/Perl/site/lib/Template/Document.pm line 138

Template::Document::process('Template::Document=HASH(0x1d74734)',
'Template::Context=HASH(0x1c001f8)') called at
E:/Perl/site/lib/Template/Context.pm line 350

eval {...} called at E:/Perl/site/lib/Template/Context.pm line 320

Template::Context::process('Template::Context=HASH(0x1c001f8)',
'Template::Document=HASH(0x1d74734)') called at
E:/Perl/site/lib/Template/Service.pm line 97

eval {...} called at E:/Perl/site/lib/Template/Service.pm line 94

Template::Service::process('Template::Service=HASH(0x1bca488)',
'list/list.html.tmpl', 'HASH(0x1bfe938)') called at E:/Perl/site/lib/Template.pm
line 76

Template::process('Bugzilla::Template=HASH(0x1bfea28)', 'list/list.html.tmpl',
'HASH(0x1bfe938)') called at E:/bugzilla/2.18/buglist.cgi line 998



ok, this looks like a bug in Time::Local itself.

in version 1.07 i don't see these errors, in 1.10 i do.

the difference is 1.10's timelocal() calls _zoneadjust, which doesn't exist in 1.07.

calling code does:

  _zoneadjust($Max{Day}, $Max{Sec}, $MaxInt);

zoneadjust is:

sub _zoneadjust {
    my ($day, $sec, $time) = @_;
    $sec = $sec + _timegm(localtime($time)) - $time;
    if ($sec >= 86400) { $day++; $sec -= 86400; }
    if ($sec <  0)     { $day--; $sec += 86400; }
    ($day, $sec);
}

note that $MaxInt gets passed to localtime(), which returns undef because it's
way of range.
oh, the template code that's causing this:

  <b>[% time2str("%a %b %e %T %Z %Y", currenttime) %]</b><br>

ah, it's actually the MinInt call that's causing the problems..

  _zoneadjust($Max{Day}, $Max{Sec}, $MinInt);

localtime(-2147483648) returns undef.
ah, this *is* a windows only problem.

on unix, calling localtime() on a negative number works.
on windows, calling localtime() on a negative number returns undef.
see http://www.mail-archive.com/datetime@perl.org/msg04724.html

the DateTime developers have already fixed this issue in their CVS tree (which
is currently down).
Time::Local 1.11 fixes this and the fix is simple.

edit lib/Time/Local.pm, look for the following line (should be at line 35):

  $MinInt = -$MaxInt - 1;

change it to:

  $MinInt = 0;

Blocks: bz-warnings
*** Bug 280906 has been marked as a duplicate of this bug. ***
this issue is a bug in activestate perl 5.8.6, and we can't work around it.

Time::Local is a core perl module, so even if i build a ppm with version 1.11 of
Time::Local, the core version will be used in preference to the ppm installed
version :(

i've added a note to the windows installation guide recommending that 5.8.6 is
to be avoided.

the workarounds for this problem are :

  - downgrade to activestate perl 5.8.4
  - wait for a new activestate perl realse and upgrade
  - edit Time/Local.pm as per comment 8

Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
*** Bug 284569 has been marked as a duplicate of this bug. ***
note that activestate perl 5.8.7 fixes this.
*** Bug 303903 has been marked as a duplicate of this bug. ***
Severity: major → trivial
I am getting a similar error under AIX 5.3, only with Date::Format.  I checked the Time::Local on my system and it looks OK (according to comment 8) - it set's $MinInt to 0 if time is undefined.  Any help getting my Date::Format problem fixed?

[Tue Jul 25 19:00:09 2006] buglist.cgi: Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.8.7/Date/Format.pm line 118.

BTW: I was going to open a new bug but thought appending to this one would be better.
(In reply to comment #14)
> BTW: I was going to open a new bug but thought appending to this one would be
> better.

  No, you're experiencing a totally different bug, so it would be better to open a new one if one hasn't already been opened. Make sure to search for "uninitialized value" before you file a new bug.
Richard filed bug 346091.
I DONT THINK SO ITS A BUG
You need to log in before you can comment on or make changes to this bug.