You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some operating systems (notably Linux) provide zero length files containing system information. Ack version 1.90 doesn't work with these files since it skips searching of all zero length files. The patch below attempts to address this issue.
--- /usr/bin/ack 2009-10-19 11:14:59.919362762 -0700
+++ bin/ack 2009-10-19 11:57:05.632362838 -0700
@@ -2481,21 +2481,24 @@
return 1 if $opt->{v};
- my $size = -s $self->{fh};
- if ( $size == 0 ) {
- return 0;
- }
- elsif ( $size > 100_000 ) {
- return 1;
+ if ( -s $self->{fh} > 100_000 ) {
+ return 1;
}
my $buffer;
- my $rc = sysread( $self->{fh}, $buffer, $size );
+ my $size;
+ my $rc;
+ do {
+ my $inbuf;
+ $size += $rc = sysread( $self->{fh}, $inbuf, 100_000 );
+ $buffer .= $inbuf;
+ } while ($rc != 0);
+
if ( not defined $rc ) {
App::Ack::warn( "$self->{filename}: $!" );
return 1;
}
- return 0 unless $rc && ( $rc == $size );
+ return 0 unless $size;
my $regex = $opt->{regex};
return $buffer =~ /$regex/m;
The text was updated successfully, but these errors were encountered:
Some operating systems (notably Linux) provide zero length files containing system information. Ack version 1.90 doesn't work with these files since it skips searching of all zero length files. The patch below attempts to address this issue.
The text was updated successfully, but these errors were encountered: