Skip Menu |

This queue is for tickets about the File-GetLineMaxLength CPAN distribution.

Report information
The Basics
Id: 27849
Status: resolved
Priority: 0/
Queue: File-GetLineMaxLength

People
Owner: Nobody in particular
Requestors: mhasch-cpanbugs [...] cozap.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.00
Fixed in: (no value)



Subject: endless loop on input not ending with eol
getline() goes into an endless loop if the last line of a file is not terminated by EOL characters. The attached patch should fix this. Happy hacking!
Subject: eof-loop.patch
--- lib/File/GetLineMaxLength.pm.dist 2004-11-12 01:54:29.000000000 +0100 +++ lib/File/GetLineMaxLength.pm 2007-07-01 07:59:17.000000000 +0200 @@ -165,7 +165,7 @@ defined($BytesRead) || die "getline failed: $!"; # Reached EOF? Just return remnants from buffer - if ($BytesRead == 0 && length($$Buffer) == 0) { + if ($BytesRead == 0) { return substr($$Buffer, 0, length($$Buffer), ''); }
Thanks for the patch. I've uploaded 1.01 with it included.