Subject: | History size is not being respected (histsize option) |
Date: | Wed, 30 Jul 2008 16:15:40 -0400 |
To: | bug-CPAN [...] rt.cpan.org |
From: | "Marchant, Rodrigo" <rodrigo.marchant [...] lan.com> |
In distribution ANDK/CPAN-1.9205.tar.gz
perl version: 5.8.5
OS: Linux xxx.yyy.zzz 2.6.9-67.0.20.ELsmp #1 SMP Wed Jun 18 12:40:47 EDT
2008 i686 i686 i386 GNU/Linux
CPAN's shell is not respecting the "histsize".
You can test this bug this way:
set "histsize" to a number bigger than 100
Enter more than 100 commands
exit
check the number of lines of the history file: it will be 100
That happens because Term::ReadLine->readline() function is cutting the
history size to
the size of the readline::rl_MaxHistorySize, that has a default of 100.
This is in line 589
of Term/ReadLine/readline.pm (version 1.0302 of
ILYAZ/modules/Term-ReadLine-Perl-1.0302.tar.gz)
The patch would be to setup the attribute MaxHistorySize of $CPAN::term
to the value of CPAN's "histsize":
--- CPAN3.pm 2007-11-11 11:45:55.000000000 +0000
+++ CPAN.pm 2008-07-30 19:52:24.000000000 +0000
@@ -1446,6 +1446,8 @@
#-> sub CPAN::readhist
sub readhist {
my($self,$term,$histfile) = @_;
+ my $histsize = $CPAN::Config->{'histsize'} || 100;
+ $term->Attribs->{'MaxHistorySize'} = $histsize if
(defined($term->Attribs->{'MaxHistorySize'}));
my($fh) = FileHandle->new;
open $fh, "<$histfile" or last;
local $/ = "\n";
That fixed the behaviour in my CPAN's shell, now I can have history
files with more than 100 commands.
Greetings,
Rodrigo Marchant