From: Eric Wong Date: Thu, 11 Dec 2025 23:06:05 +0000 (+0000) Subject: fix closing gzipped mboxrd from curl w/o IO::KQueue X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=697a961517f5cd89bacf9bc04570e6c0495d5868;p=thirdparty%2Fpublic-inbox.git fix closing gzipped mboxrd from curl w/o IO::KQueue While the `waitpid' perlop retries on EINTR, it preserves the `errno == EINTR' value after eventual success of the underlying wait4/waitpid syscall. Preserving `$!' confuses IO::Uncompress::Base::close into saving `$!' in the IO::Uncompress::Base::saveErrorString call. Saving `$!' there caused the `$mbfh->close' call to fail in PublicInbox::MboxReader::_mbox_from in t/solver_git.t when accessing remote URLs (`lei blob --no-mail 69df7d5 -I $rurl'). So now we always clobber `$!' after successful `waitpid' perlops to ensure subsequent calls don't misreport errors. Only noticed when testing on FreeBSD 13.5 without IO::KQueue while chasing t/solver_git.t regression I noticed on Debian 13.x --- diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 70c6c844f..12ca38a35 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -687,8 +687,11 @@ sub awaitpid { $AWAIT_PIDS{$pid} = \@cb_args if @cb_args; # provide synchronous API if (defined(wantarray) || (!$in_loop && !@cb_args)) { - my $ret = waitpid($pid, 0); + my $ret = waitpid($pid, 0); # n.b. Perl auto retries on EINTR if ($ret == $pid) { + # prevent IO::Uncompress::Base::close from giving $! + # to IO::Uncompress::Base::saveErrorString: + $! = 0; my $cb_args = delete $AWAIT_PIDS{$pid}; @cb_args = @$cb_args if !@cb_args && $cb_args; await_cb($pid, @cb_args);