Subject: | substr outside of string when using long prompt |
Encounter this bug using git-send-email on OS X 10.5.3, perl 5.8.8, and
readline 1.0302.
When using a prompt wider than the screen, the following line fails:
1976: $dline = substr($dline, (length $prompt) - $si);
At this point, the following is true:
# 80 column screen
$prompt == 'x' x 81 # xxxx...xxxxxxx
$dline == 'x' x 79 . '>' # xxxx...xxxxx>
$si == 0
(length $prompt) - $si == 81
(length $dline) == 80
substr( $dline, 81 ) == failure
Test case follows:
------
$ cat temp.pl
#!/usr/bin/perl -w
# Use an 80 column terminal
use Term::ReadLine;
$term = new Term::ReadLine 'test';
$term->readline('x'x81);
$ ./temp.pl
substr outside of string at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1976.
Use of uninitialized value in length at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1785.
Use of uninitialized value in length at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1791.
Use of uninitialized value in substr at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1802.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxUse
of uninitialized value in length at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 2046.
substr outside of string at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1976.
Use of uninitialized value in string eq at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1998.
Use of uninitialized value in string eq at
/Library/Perl/5.8.8/Term/ReadLine/readline.pm line 1998.
$