Skip Menu |

This queue is for tickets about the perlindex CPAN distribution.

Report information
The Basics
Id: 70755
Status: open
Worked: 45 min
Priority: 0/
Queue: perlindex

People
Owner: Nobody in particular
Requestors: dpchrist [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.605
Fixed in: (no value)



Subject: perlindex-1.605 Can't take log of -612.333 at /usr/local/bin/perlindex line 361
When attempting to run perlindex 1.605, I was getting the following error message: 2011-09-05 19:44:04 dpchrist@p43400e ~ $ perlindex dpchrist Can't take log of -612.333 at /usr/local/bin/perlindex line 361. I haven't studied the program to find the root cause, but this hack works around the error: 2011-09-05 19:55:57 root@p43400e ~/build # diff -r perlindex-1.605 perlindex-1.605-dpc diff -r perlindex-1.605/perlindex.PL perlindex-1.605-dpc/perlindex.PL 428c428,430 < my $idf = log($FN{'last'}/$IDF{$word}); --- Show quoted text
> # my $idf = log($FN{'last'}/$IDF{$word}); > my $qqqq = $FN{'last'}/$IDF{$word}; > my $idf = 0 < $qqqq ? log($qqqq) : 0;
HTH, David
On 2011-09-05 23:07:29, DPCHRIST wrote: Show quoted text
> When attempting to run perlindex 1.605, I was getting the following > error message: > > 2011-09-05 19:44:04 dpchrist@p43400e ~ > $ perlindex dpchrist > Can't take log of -612.333 at /usr/local/bin/perlindex line 361. > > I haven't studied the program to find the root cause, but this hack > works around the error: > > 2011-09-05 19:55:57 root@p43400e ~/build > # diff -r perlindex-1.605 perlindex-1.605-dpc > diff -r perlindex-1.605/perlindex.PL perlindex-1.605-dpc/perlindex.PL > 428c428,430 > < my $idf = log($FN{'last'}/$IDF{$word}); > ---
> > # my $idf = log($FN{'last'}/$IDF{$word}); > > my $qqqq = $FN{'last'}/$IDF{$word}; > > my $idf = 0 < $qqqq ? log($qqqq) : 0;
>
I see the same problem on a Debian/squeeze system which perlindex-1.605-2 installed: $ perlindex ctime Can't take log of -100.206 at /usr/bin/perlindex line 371. Regards, Slaven
Hello, your report indicates that $FN{'last'}/$IDF{$word} is negative. As FN{'last'} is only incremented, $IDF{$word} must be the problem. It is decremeted only in the grabadge collecting code. The code there looks correct though. Can you advise how to reproduce the problem? Ulrich
If it is a GC problem, the following untested patch may make the code a little more robust. It would be good if you could help to reproduce the problem. Ulrich
Subject: gc.patch
Index: perlindex-1.605/perlindex.PL =================================================================== --- perlindex-1.605.orig/perlindex.PL 2013-01-06 20:47:17.957095071 +0100 +++ perlindex-1.605/perlindex.PL 2013-01-06 21:48:27.029096048 +0100 @@ -156,12 +156,12 @@ my %post = unpack($p.'*',$list); #delete $IF{$word}; + $IDF{$word} = 0; while (my ($did,$tf) = each %post) { if (exists $FN{$did}) { $if_new{$word} = '' unless defined $if{$word}; # perl -w $if_new{$word} .= pack($p.$p, $did, $tf); - } else { - $IDF{$word}--; + $IDF{$word}++; } } }
Subject: Re: [rt.cpan.org #70755] perlindex-1.605 Can't take log of -612.333 at /usr/local/bin/perlindex line 361
Date: Sun, 06 Jan 2013 17:26:06 -0800
To: bug-perlindex [...] rt.cpan.org
From: David Christensen <dpchrist [...] holgerdanske.com>
On 01/06/13 12:41, Ulrich_Pfeifer via RT wrote: Show quoted text
> your report indicates that $FN{'last'}/$IDF{$word} is negative. > As FN{'last'} is only incremented, $IDF{$word} must be the problem. > It is decremeted only in the grabadge collecting code. The code there > looks correct though. > > Can you advise how to reproduce the problem?
The problem seems to be fixed in current Debian stable (Squeeze): 2013-01-06 17:19:44 dpchrist@p43400e ~ $ dpkg-query -l perlindex Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii perlindex 1.605-2 Perl manual pages index and query applicatio And also in current Debian testing (Wheezy): 2013-01-06 17:22:21 dpchrist@i72600s ~ $ dpkg-query -l perlindex Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-================================= ii perlindex 1.605-4 all Perl manual pages index and query HTH, David