From: Eric Wong Date: Tue, 26 Aug 2025 19:50:43 +0000 (+0000) Subject: lei_saved_search: avoid //= on complex hashref assignment X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=888a7e7d04065302336de7acbc6fedfff6efa378;p=thirdparty%2Fpublic-inbox.git lei_saved_search: avoid //= on complex hashref assignment Setting $self->{oidx} via `//=' may be unsafe due to ->lock_for_scope setting $self->{lock_fh}. While this is not known to cause problems at the moment, it may be problematic in future as we've had to deal with subtle bugs in similar code in the past. --- diff --git a/lib/PublicInbox/LeiSavedSearch.pm b/lib/PublicInbox/LeiSavedSearch.pm index aed8b0c9c..3361f758a 100644 --- a/lib/PublicInbox/LeiSavedSearch.pm +++ b/lib/PublicInbox/LeiSavedSearch.pm @@ -229,7 +229,7 @@ sub is_dup { sub prepare_dedupe { my ($self) = @_; - $self->{oidx} //= do { + $self->{oidx} // do { my $creat = !-f $self->{-ovf}; my $lk = $self->lock_for_scope; # git-config doesn't wait my $oidx = PublicInbox::OverIdx->new($self->{-ovf}); @@ -237,7 +237,7 @@ sub prepare_dedupe { $oidx->{journal_mode} = 'WAL'; $oidx->dbh; $oidx->eidx_prep if $creat; # for xref3 - $oidx + $self->{oidx} = $oidx }; }