unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/2] lei: use ->child_error API properly
Date: Sat, 16 Dec 2023 11:13:16 +0000	[thread overview]
Message-ID: <20231216111316.397070-3-e@80x24.org> (raw)
In-Reply-To: <20231216111316.397070-1-e@80x24.org>

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(-)

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);
 	};

      parent reply	other threads:[~2023-12-16 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 11:13 [PATCH 0/2] lei bugfixes Eric Wong
2023-12-16 11:13 ` [PATCH 1/2] lei index: support +L: labels Eric Wong
2023-12-16 11:13 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231216111316.397070-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).