Subject: | Newsrc fails with very large article counts |
Date: | Sun, 3 Jun 2012 17:14:38 +0100 |
To: | bug-News-Newsrc [...] rt.cpan.org |
From: | Nicholas Redgrave <baron [...] bologrew.net> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Newsrc fails when writing very large article counts back to the .newsrc file.
My ISP's news server has some newsgroups where the article number exceeds
2147483647.
Newsrc can read large numbers but cannot write them back.
Module: News-Newsrc-1.09
Perl version: perl 5, version 12, subversion 4 (v5.12.4) built for i386-linux-
thread-multi
OS: Linux njr 2.6.43.5-2.fc15.i686 #1 SMP Tue May 8 12:07:12 UTC 2012 i686
i686 i386 GNU/Linux
The following code demonstrates the problem when rerun several times with a
.newsrc as follows:
fake.fail: 2147483646
fake.okay: 10000
#!/usr/bin/perl
use News::Newsrc;
use strict;
use warnings;
my $grp;
my $saved_art;
my @groups;
# reads saved article count, increments and writes back
# saving fails when article count exceeds 2147483647
# test using .newsrc as follows:
#fake.fail: 2147483646
#fake.okay: 10000
#handle stored article count
my $newsrc=News::Newsrc->new();
$newsrc->load();
@groups = $newsrc->groups();
foreach $grp (@groups)
{
print "Group: " . $grp ."\n";
#get last read article
$saved_art = $newsrc->get_articles($grp);
print "saved_art: " . $saved_art ."\n";
$saved_art++;
#set last read article
$newsrc->set_articles($grp, $saved_art);
$newsrc->save();
} #end of foreach $grp (@groups)
#eof
A quick fix is to comment out this line in Newsrc.pm:
defined $min and $min < 0 and return 0;
in "sub set_articles".
Best regards,
Nicholas Redgrave
- --
Fingerprint for GnuPG ID 0x0189562F
ADCF CC73 0DFB 9613 FA78 553B C98C 086F 0189 562F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
iD8DBQFPy413yYwIbwGJVi8RAlzWAJ91gZZ3RK6er54XkYlmJpEHcQXpLACeN/wR
BThpkw1X/mO1Gg66+lNX50s=
=OfLv
-----END PGP SIGNATURE-----