From: Eric Wong Date: Wed, 25 Oct 2023 00:29:49 +0000 (+0000) Subject: cindex: use sysread for generating fingerprint X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a309ca6ba5f3c0a541bb15414a4c3357a86dfbda;p=thirdparty%2Fpublic-inbox.git cindex: use sysread for generating fingerprint We use sysseek for this file handle elsewhere (since it's passed to `git rev-list --stdin' multiple times), and sysread ensures we can use a larger read buffer than the tiny 8K BUFSIZ Perl + glibc is contrained to. This also ensures we autodie on sysread failures, since the autodie import for `read' was missing and we don't call `read' anywhere else in this file. --- diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index e17cba39b..e31432b9a 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -57,7 +57,7 @@ use PublicInbox::Git qw(%OFMT2HEXLEN); use PublicInbox::Compat qw(uniqstr); use PublicInbox::Aspawn qw(run_await); use Carp (); -use autodie qw(pipe open seek sysseek send); +use autodie qw(pipe open sysread seek sysseek send); our $DO_QUIT = 15; # signal number our ( $LIVE_JOBS, # integer @@ -385,10 +385,10 @@ sub fp_start ($$$) { sub fp_fini { # run_git cb my (undef, $self, $git, $prep_repo) = @_; my $refs = $git->{-repo}->{refs} // die 'BUG: no {-repo}->{refs}'; - seek($refs, 0, SEEK_SET); + sysseek($refs, 0, SEEK_SET); my $buf; my $dig = PublicInbox::SHA->new(256); - while (read($refs, $buf, 65536)) { $dig->add($buf) } + while (sysread($refs, $buf, 65536)) { $dig->add($buf) } $git->{-repo}->{fp} = $dig->hexdigest; }