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-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 13ACE1F5AE for ; Mon, 6 Jul 2020 04:20:13 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] inboxidle: warn on inotify_add_watch failures Date: Mon, 6 Jul 2020 04:20:12 +0000 Message-Id: <20200706042012.29146-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: inotify_add_watch(2), open(2), stat(2) may all fail due to permissions errors, especially when running -nntpd/-imapd as `nobody' as recommended. --- lib/PublicInbox/InboxIdle.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index bdb30284a..0cdd2e2a8 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -41,8 +41,11 @@ sub in2_arm ($$) { # PublicInbox::Config::each_inbox callback $cur->[0] = $ibx; my $lock = "$dir/".($ibx->version >= 2 ? 'inbox.lock' : 'ssoma.lock'); - my $w = $cur->[1] = $inot->watch($lock, $IN_MODIFY); - $self->{on_unlock}->{$w->name} = $ibx; + if (my $w = $cur->[1] = $inot->watch($lock, $IN_MODIFY)) { + $self->{on_unlock}->{$w->name} = $ibx; + } else { + warn "E: ".ref($inot)."->watch($lock, IN_MODIFY) failed: $!\n"; + } # TODO: detect deleted packs (and possibly other files) }