From 84874a852c80e3d4eb96af14c017b37424cdf840 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 16 Dec 2023 11:13:16 +0000 Subject: lei: use ->child_error API properly I noticed this bug while developing another feature and tests were getting SIGHUP (since SIGHUP == 1 on most systems). --- lib/PublicInbox/LeiExportKw.pm | 4 ++-- lib/PublicInbox/LeiMirror.pm | 2 +- lib/PublicInbox/LeiToMail.pm | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/LeiExportKw.pm b/lib/PublicInbox/LeiExportKw.pm index d2396fa7..16f069da 100644 --- a/lib/PublicInbox/LeiExportKw.pm +++ b/lib/PublicInbox/LeiExportKw.pm @@ -38,7 +38,7 @@ sub export_kw_md { # LeiMailSync->each_src callback } elsif ($! == EEXIST) { # lost race with lei/store? return; } elsif ($! != ENOENT) { - $lei->child_error(1, + $lei->child_error(0, "E: rename_noreplace($src -> $dst): $!"); } # else loop @try } @@ -46,7 +46,7 @@ sub export_kw_md { # LeiMailSync->each_src callback # both tries failed my $oidhex = unpack('H*', $oidbin); my $src = "$mdir/{".join(',', @try)."}/$$id"; - $lei->child_error(1, "rename_noreplace($src -> $dst) ($oidhex): $e"); + $lei->child_error(0, "rename_noreplace($src -> $dst) ($oidhex): $e"); for (@try) { return if -e "$mdir/$_/$$id" } $self->{lms}->clear_src("maildir:$mdir", $id); } diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 0c77a8b5..5353ae61 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -1175,7 +1175,7 @@ sub try_manifest { local $self->{-local_manifest} = load_current_manifest($self); local $self->{-new_symlinks} = []; my ($path_pfx, $n, $multi) = multi_inbox($self, \$path, $m); - return $lei->child_error(1, $multi) if !ref($multi); + return $lei->child_error(0, $multi) if !ref($multi); my $v2 = delete $multi->{v2}; if ($v2) { for my $name (sort keys %$v2) { diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index a930fc30..071ba113 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -147,9 +147,9 @@ sub git_to_mail { # git->cat_async callback $type = 'blob'; $size = length($$bref); } - $type eq 'blob' or return $self->{lei}->child_error(1, + $type eq 'blob' or return $self->{lei}->child_error(0, "W: $oid is $type (!= blob)"); - $size or return $self->{lei}->child_error(1,"E: $oid is empty"); + $size or return $self->{lei}->child_error(0,"E: $oid is empty"); $smsg->{blob} eq $oid or die "BUG: expected=$smsg->{blob}"; $self->{wcb}->($bref, $smsg); }; -- cgit v1.2.3-24-ge0c7