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 4175D1F4B4; Sat, 17 Apr 2021 00:00:22 +0000 (UTC) Date: Sat, 17 Apr 2021 00:00:22 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [SQUASH] fix "d:YYYYMMDD..$NEEDS_APPROXIDATE" case Message-ID: <20210417000022.GA29300@dcvr> References: <20210416234306.28897-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210416234306.28897-1-e@80x24.org> List-Id: diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index e0e8164d..fbcff2c3 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -302,7 +302,10 @@ sub date_parse_prepare { $x = "$fmt$#$to_parse\0"; } if ($pfx eq 'dt') { - s/\0%Y%m%d/\0%Y%m%d%H%M%S/ for @r; + for (@r) { + s/\0%Y%m%d/\0%Y%m%d%H%M%S/; + s/\A([0-9]{8})\z/${1}000000/; + } } } } elsif ($pfx eq 'dt') { diff --git a/t/search.t b/t/search.t index b63a7672..47a67f7f 100644 --- a/t/search.t +++ b/t/search.t @@ -630,6 +630,11 @@ SKIP: { like($qs, qr/\Abroken dt:$x_days_ago[0-9]{6}\.\./, 'date.phrase.with.dots'); + $orig = $qs = 'd:20101002..now'; + $s->query_approxidate($g, $qs); + like($qs, qr/\Adt:20101002000000\.\.[0-9]{14}\z/, + 'approxidate on range-end only'); + $ENV{TEST_EXPENSIVE} or skip 'TEST_EXPENSIVE not set for argv overflow check', 1; my @w;