From dd029354eb69c4faf3160640828fd8e7b9403855 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 13 Feb 2023 01:02:12 +0000 Subject: imap: quiet Parse::RecDescent errors on bad search queries Parse::RecDescent emits giant errors to STDERR by default (bypassing $SIG{__WARN__}, even). Shut it up since there's no good way to pass those back to a client, and we don't want clients flooding logs with bogus requests. --- lib/PublicInbox/IMAPsearchqp.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/IMAPsearchqp.pm') diff --git a/lib/PublicInbox/IMAPsearchqp.pm b/lib/PublicInbox/IMAPsearchqp.pm index 9f0c1205..0c37220c 100644 --- a/lib/PublicInbox/IMAPsearchqp.pm +++ b/lib/PublicInbox/IMAPsearchqp.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # IMAP search query parser. cf RFC 3501 @@ -279,6 +279,8 @@ sub parse { my $sql = ''; %$q = (sql => \$sql, imap => $imap); # imap = PublicInbox::IMAP obj # $::RD_TRACE = 1; + local $::RD_ERRORS = undef; + local $::RD_WARN = undef; my $res = eval { $prd->search_key(uc($query)) }; return $@ if $@ && $@ =~ /\A(?:BAD|NO) /; return 'BAD unexpected result' if !$res || $res != $q; -- cgit v1.2.3-24-ge0c7