From: Eric Wong Date: Sun, 24 Oct 2021 00:20:45 +0000 (-0600) Subject: git: avoid Perl5 internal scratchpad target cache X-Git-Tag: v1.7.0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48af2131c7ef0e7001f99fe3c2dabd1713d3e800;p=thirdparty%2Fpublic-inbox.git git: avoid Perl5 internal scratchpad target cache Creating a scalar ref directly off substr() seemed to be causing the underlying non-ref scalar to end up in Perl's scratchpad. Assign the substr result to a local variable seems sufficient to prevent multi-megabyte SVs from lingering indefinitely when a read-only daemon serves rare, oversized blobs. --- diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 374a3b4dd..4078dd5b7 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -158,7 +158,8 @@ sub my_read ($$$) { return; # unrecoverable error } } - \substr($$rbuf, 0, $len, ''); + my $no_pad = substr($$rbuf, 0, $len, ''); + \$no_pad; } sub my_readline ($$) {