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 2/8] searchidx: die on cat-file failures
  2020-04-18  3:38  4% [PATCH 0/8] some small yak shaving things Eric Wong
@ 2020-04-18  3:38  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-04-18  3:38 UTC (permalink / raw)
  To: meta

We always use the object ID from "git <log|rev-list>" for
retrieving blobs, so fail loudly if the git repository is
corrupt instead of silently continuing.
---
 lib/PublicInbox/SearchIdx.pm | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index 05689941..d1290dc2 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -551,13 +551,11 @@ sub unindex_both {
 
 sub do_cat_mail {
 	my ($git, $blob, $sizeref) = @_;
-	my $mime = eval {
-		my $str = $git->cat_file($blob, $sizeref);
-		# fixup bugs from import:
-		$$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
-		PublicInbox::MIME->new($str);
-	};
-	$@ ? undef : $mime;
+	my $str = $git->cat_file($blob, $sizeref) or
+		die "BUG: $blob not found in $git->{git_dir}";
+	# fixup bugs from import:
+	$$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+	PublicInbox::MIME->new($str);
 }
 
 # called by public-inbox-index
@@ -602,7 +600,7 @@ sub read_log {
 				}
 				next;
 			}
-			my $mime = do_cat_mail($git, $blob, \$bytes) or next;
+			my $mime = do_cat_mail($git, $blob, \$bytes);
 			my $smsg = bless {}, 'PublicInbox::Smsg';
 			batch_adjust(\$max, $bytes, $batch_cb, $latest, ++$nr);
 			$smsg->{blob} = $blob;
@@ -623,7 +621,7 @@ sub read_log {
 	close($log) or die "git log failed: \$?=$?";
 	# get the leftovers
 	foreach my $blob (keys %D) {
-		my $mime = do_cat_mail($git, $blob, \$bytes) or next;
+		my $mime = do_cat_mail($git, $blob, \$bytes);
 		$del_cb->($self, $mime);
 	}
 	$batch_cb->($nr, $latest, $newest);

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/8] some small yak shaving things
@ 2020-04-18  3:38  4% Eric Wong
  2020-04-18  3:38  7% ` [PATCH 2/8] searchidx: die on cat-file failures Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-04-18  3:38 UTC (permalink / raw)
  To: meta

Eric Wong (8):
  inboxwritable: mime_from_path: reuse in more places
  searchidx: die on cat-file failures
  inbox: do not memoize description or cloneurl if missing
  inbox: replace `eval {}' with `do {}' where appropriate
  favor `do {}' over `eval {}' for localized slurp
  wwwatomstream: move {emit_header} field to $self
  mbox: use per-message line-ending for From_ line
  reduce scope of mbox From_ line removal

 Documentation/mknews.perl               |  2 +-
 MANIFEST                                |  4 ++--
 lib/PublicInbox/Inbox.pm                | 27 ++++++++++++------------
 lib/PublicInbox/InboxWritable.pm        |  4 ++--
 lib/PublicInbox/Mbox.pm                 |  7 +++++--
 lib/PublicInbox/NNTP.pm                 |  2 ++
 lib/PublicInbox/SearchIdx.pm            | 14 +++++--------
 lib/PublicInbox/WatchMaildir.pm         |  6 +++---
 lib/PublicInbox/WwwAtomStream.pm        |  5 ++---
 script/public-inbox-edit                |  5 ++---
 script/public-inbox-learn               |  6 +++---
 script/public-inbox-mda                 |  2 +-
 script/public-inbox-purge               |  2 +-
 scripts/import_maildir                  |  4 ++--
 scripts/import_slrnspool                |  2 +-
 scripts/slrnspool2maildir               |  2 +-
 scripts/ssoma-replay                    |  5 +----
 t/inbox.t                               | 19 +++++++++++++++++
 t/{iso-2202-jp.mbox => iso-2202-jp.eml} |  1 -
 t/mda.t                                 | 10 ++++-----
 t/msg_iter.t                            | 18 ++++++----------
 t/nntpd-tls.t                           |  8 +++----
 t/psgi_v2.t                             | 28 ++++++++++++++++---------
 t/search.t                              | 12 ++++-------
 t/solver_git.t                          |  4 ++--
 t/{utf8.mbox => utf8.eml}               |  1 -
 t/v2reindex.t                           |  3 +--
 t/watch_maildir_v2.t                    |  2 +-
 28 files changed, 105 insertions(+), 100 deletions(-)
 rename t/{iso-2202-jp.mbox => iso-2202-jp.eml} (84%)
 rename t/{utf8.mbox => utf8.eml} (90%)

^ permalink raw reply	[relevance 4%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-04-18  3:38  4% [PATCH 0/8] some small yak shaving things Eric Wong
2020-04-18  3:38  7% ` [PATCH 2/8] searchidx: die on cat-file failures 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).