Humble Greetings, dear Monks,
I've gotten XML-Writer.pm to test correctly under perl 5.6!
Also, I have *some* idea where the problem lies, but I'd really like a
decent explanation as to what's actually going on behind the scenes.
The original problem follows, then the solution:
> I've just upgraded to RH7.1, well behind the boat, including a perl version jump from 5.005-03 to 5.6.0 and noticed that my XML::Writer module was no
> longer happy about its make-time tests.
>
> Not just mine, but the latest from cpan, or for example the credible
> http://www.rpmfind.net/linux/RPM/PLD//PLD-1.0/SRPMS/SRPMS//perl-XML-Writer-0.4-3.src.html
>
> On make test, I get
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl
+5/5.6.0/i386-linux -I/usr/lib/perl5/5.6.0 test.pl
1..43
ok 1
...
ok 39
Attempt to free unreferenced scalar at test.pl line 513.
make: *** [test_dynamic] Segmentation fault (core dumped)
Exit 2
>
> The compile and test are perfectly happy on a machine that still has 5.005-03.
>
> Now I'm pretty familiar with the module itself, have made some code changes and such (this is a virgin test tho), and dug around in it a bit, but I'm not exactly
> sure what kind of objectionable material to be looking for w.r.t. this error.
>
> I'm not averse to putting some time into this, but I'm not clear where to start. Any pointers (at least those with a positive ref count when trying to get freed :-)
> would be greatly appreciated.
While diligently commenting out possible sections of code to try and sniff out what the problem was, I noticed the following error during test:
ok 35
ok 36
ok 37
Expected error did not occur!
not ok 38
ok 39
Expected error did not occur!
not ok 40
ok 41
Not an ARRAY reference at blib/lib/XML/Writer.pm line 905.
not ok 42
make: *** [test_dynamic] Segmentation fault (core dumped)
Exit 2
So it wasn't the same test as the error, but it got me thinking... Line 905 says:
899: #
900: # Check names.
901: #
902: sub _checkNSNames {
903: my $names = $_[0];
904: my $i = 1;
905: my $name = $names->[0];
Now there are a lot of things that are supposed to be arrayrefs, but the thing getting passed in was
801: _checkNSNames(\@_);
and
813: _checkNSNames(\@_);
So on a whim I tried changing these to
_checkNSNames([ @_ ]);
to induce an explicit copy instead of passing on the arguments ref. I was going to maybe examine the contents during test here next. Baby steps.
Well what do you know, I just didn't get any errors anymore! Nor when I put everything else back. So It seems the segmentation fault happened because the reference to the subroutine args wasn't handled right?
Any ideas or insight?
BTW, I *will* actually go let the author know now...
Thanks,
Gremio