Skip Menu |

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

Report information
The Basics
Id: 132900
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: cwhitener [...] gmail.com
Requestors: baohaojun [...] lixiang.com
Cc:
AdminCc:

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



CC: baohaojun [...] gmail.com
Subject: read_file("/dev/stdin") not working on FreeBSD
Date: Sun, 28 Jun 2020 21:56:33 +0800
To: bug-File-Slurp [...] rt.cpan.org
From: Bao Haojun <baohaojun [...] lixiang.com>
- Module version: File-Slurp-9999.30 - Perl version: This is perl 5, version 30, subversion 3 (v5.30.3) built for amd64-freebsd-thread-multi Copyright 1987-2020, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. - OS version: FreeBSD freebsd.bhj 12.1-RELEASE FreeBSD 12.1-RELEASE r354233 GENERIC amd64 amd64 Intel(R) Core(TM) i7-4600M CPU @ 2.90GHz FreeBSD - How to reproduce: seq 1 20000|perl -e 'use File::Slurp; print(read_file("/dev/stdin"))' - On Linux, the last line is 20000 - On FreeBSD, the last line is 1277 (the line before is 12773) - Suggested patch: diff --git a/lib/perl5/File/Slurp.pm b/lib/perl5/File/Slurp.pm index 5ceb974..cf812b3 100755 --- a/lib/perl5/File/Slurp.pm +++ b/lib/perl5/File/Slurp.pm @@ -102,7 +102,7 @@ sub read_file { my $buf_ref = $opts->{buf_ref} || \$buf; ${$buf_ref} = ''; my $blk_size = $opts->{blk_size} || 1024 * 1024; - if (my $size = -s $fh) { + if (my $size = (-f $fh and -s $fh)) { $blk_size = $size if $size < $blk_size; my ($pos, $read) = 0; do {
Just released in 9999.31. Thanks!