user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/2] idx_stack: avoid conditional hash assignment weirdness
  2021-11-01 19:06  5% [PATCH 0/2] avoid problematic conditional hash assignments Eric Wong
@ 2021-11-01 19:06  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-11-01 19:06 UTC (permalink / raw)
  To: meta

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.
---
 lib/PublicInbox/IdxStack.pm | 4 ++--
 1 file 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);

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] avoid problematic conditional hash assignments
@ 2021-11-01 19:06  5% Eric Wong
  2021-11-01 19:06  7% ` [PATCH 1/2] idx_stack: avoid conditional hash assignment weirdness Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-11-01 19:06 UTC (permalink / raw)
  To: meta

Perhaps these will fix some occasional test failures I'm seeing

Eric Wong (2):
  idx_stack: avoid conditional hash assignment weirdness
  treewide: avoid problematic "$h->{k} //= do {" assignments

 lib/PublicInbox/Config.pm    | 7 +++----
 lib/PublicInbox/Git.pm       | 2 +-
 lib/PublicInbox/IMAP.pm      | 4 ++--
 lib/PublicInbox/IdxStack.pm  | 4 ++--
 lib/PublicInbox/Inbox.pm     | 2 +-
 lib/PublicInbox/LEI.pm       | 9 +++++----
 lib/PublicInbox/SharedKV.pm  | 4 ++--
 lib/PublicInbox/WWW.pm       | 4 ++--
 lib/PublicInbox/WwwStatic.pm | 2 +-
 lib/PublicInbox/WwwStream.pm | 4 ++--
 10 files changed, 21 insertions(+), 21 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-11-01 19:06  5% [PATCH 0/2] avoid problematic conditional hash assignments Eric Wong
2021-11-01 19:06  7% ` [PATCH 1/2] idx_stack: avoid conditional hash assignment weirdness Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).