From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A54D41F461 for ; Wed, 26 Jun 2019 09:00:43 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] watchmaildir: show the current path on spamcheck failures Date: Wed, 26 Jun 2019 09:00:43 +0000 Message-Id: <20190626090043.18679-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Knowing which message failed a spam check is tough when I have many Maildirs and don't have a search indexing tool setup for spam mail. --- lib/PublicInbox/WatchMaildir.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index 2d4c6f4..a76bf06 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -150,6 +150,12 @@ sub _try_path { if (!ref($inboxes) && $inboxes eq 'watchspam') { return _remove_spam($self, $path); } + + my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ }; + local $SIG{__WARN__} = sub { + $warn_cb->("path: $path\n"); + $warn_cb->(@_); + }; foreach my $ibx (@$inboxes) { my $mime = _path_to_mime($path) or next; my $im = _importer_for($self, $ibx); -- EW