http://www.perlmonks.org?node_id=1027818

megaframe has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

First let me start by saying the file I have does apear to be damaged.

Background:

I have a log file parser that uses IO::Uncompress:Bunzip2 so I can open compressed files without needing to uncompress the entire contents. This works out to be much faster as sometimes I only need a few lines from the files. Problem is I have a ascii text file that has a corrupted line, not sure on the contents, it's very large and VIM stalls and truncates at that line. If I use Bunzip2 module to read the file it stalls there and causes a segmentation fault (see the trace below). If I unzip the file so now its just a regular ascii file and use perl's built in open and step through using while($line = <$file>) everything is fine (perl still seems to "pause" at the broken line but eventually moves past it and parses the rest of the file. I'd love to get that reaction from Bunzip2 but I just keep getting the Segmentation faults.

Any help would be appreciated.

>> /home/utils/perl-5.14/5.14.1-threads-64/lib/5.14.1/IO/Uncompress/Ba +se.pm:884: if (*$self->{Encoding}) { >> /home/utils/perl-5.14/5.14.1-threads-64/lib/5.14.1/IO/Uncompress/Ba +se.pm:889: if ($status == STATUS_ENDSTREAM) { >> /home/utils/perl-5.14/5.14.1-threads-64/lib/5.14.1/IO/Uncompress/Ba +se.pm:929: return $buf_len ; >> /home/utils/perl-5.14/5.14.1-threads-64/lib/5.14.1/IO/Uncompress/Ba +se.pm:1092: return $len ; >> /home/utils/perl-5.14/5.14.1-threads-64/lib/5.14.1/IO/Uncompress/Ba +se.pm:1178: my $offset = index($line, $/); Segmentation fault