Skip Menu |
 

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 104671
Status: open
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.0121
Fixed in: (no value)



Subject: 11memory.t: uninitialized variable
Download (untitled) / with headers
text/plain 111b
The variable $LibXML::TOTALMEM is not initialized on the first invocation. Guard against the spurious warning.
Subject: perl-XML-LibXML.src2.patch
--- origsrc/XML-LibXML-2.0121/t/11memory.t 2012-08-09 09:31:14.000000000 +0200 +++ src/XML-LibXML-2.0121/t/11memory.t 2015-05-24 18:24:01.691090400 +0200 @@ -501,7 +501,7 @@ sub check_mem { } close ($FH); - if ($LibXML::TOTALMEM != $mem{Total}) { + if ($initialise or $LibXML::TOTALMEM != $mem{Total}) { warn("LEAK! : ", $mem{Total} - $LibXML::TOTALMEM, " $units\n") unless $initialise; $LibXML::TOTALMEM = $mem{Total}; }
Download (untitled) / with headers
text/plain 354b
Hi, On Sun May 24 13:43:15 2015, https://me.yahoo.com/howdidwegetherereally#f714d wrote: Show quoted text
> The variable $LibXML::TOTALMEM is not initialized on the first > invocation. Guard against the spurious warning.
shouldn't your patch be "if ((!$initialize) and ($LibXML::TOTALMEM != $mem{Total}))"? Otherwise - there seems like there will always be a warning.
Download (untitled) / with headers
text/plain 795b
On Fri May 29 03:40:03 2015, SHLOMIF wrote: Show quoted text
> shouldn't your patch be "if ((!$initialize) and ($LibXML::TOTALMEM != > $mem{Total}))"? Otherwise - there seems like there will always be a > warning.
No, $initialise is 1 during initialisation and undef otherwise. The point of checking it in the if clause is to avoid the comparison of the not-yet-initialised $LibXML::TOTALMEM, which is the source of the spurious warning: Use of uninitialized value $LibXML::TOTALMEM in numeric ne (!=) at t/11memory.t line 504. You can do something different instead if that looks cleaner to you: if (($LibXML::TOTALMEM//-1) != $mem{Total}) Or even just initialise the variable outside of the sub before the first call.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.