about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-11-01 19:06:08 +0000
committerEric Wong <e@80x24.org>2021-11-01 19:49:38 +0000
commitb46de4da83d797281af9603f350e5b7105845eed (patch)
tree07c64258749a9b8bcef4b69cb7ed480aaca09d24
parent22ac219d0a2cf78e60d853c2ea527ef5f2a84497 (diff)
downloadpublic-inbox-b46de4da83d797281af9603f350e5b7105845eed.tar.gz
I've been seeing the following error on occasion during "make check-run":
$PWD/t/data-gen/reindex-time-range.v1-master index failed: Modification of a read-only value attempted at $DIR/lib/PublicInbox/SearchIdx.pm line 899, <$r> line 1.

Perhaps this fixes it.  In any case, a construct of:

	 $h->{k} //= do { $h->{x} = ...; $val };

seems wrong and may cause Perl to error out depending on how
hashes are randomized.
-rw-r--r--lib/PublicInbox/IdxStack.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/IdxStack.pm b/lib/PublicInbox/IdxStack.pm
index d5123006..54d480bd 100644
--- a/lib/PublicInbox/IdxStack.pm
+++ b/lib/PublicInbox/IdxStack.pm
@@ -20,12 +20,12 @@ sub new {
 sub push_rec {
         my ($self, $file_char, $at, $ct, $blob_oid, $cmt_oid) = @_;
         my $rec = pack(PACK_FMT, $file_char, $at, $ct, $blob_oid, $cmt_oid);
-        $self->{unpack_fmt} //= do {
+        $self->{unpack_fmt} // do {
                 my $len = length($cmt_oid);
                 my $fmt = PACK_FMT;
                 $fmt =~ s/H\*/H$len/g;
                 $self->{rec_size} = length($rec);
-                $fmt;
+                $self->{unpack_fmt} = $fmt;
         };
         print { $self->{wr} } $rec or die "print: $!";
         $self->{tot_size} += length($rec);