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,AWL,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 7E1581F609; Mon, 10 Jun 2019 06:21:05 +0000 (UTC) Date: Mon, 10 Jun 2019 06:21:05 +0000 From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Subject: [PATCH 5/4] git: ensure ->modified returns an integer Message-ID: <20190610062105.rbfpfor7jf7x4trz@dcvr> References: <20190609043105.22338-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190609043105.22338-1-e@80x24.org> List-Id: We don't want to serialize timestamps as strings to JSON. I only noticed this bug on a 32-bit system. --- lib/PublicInbox/Git.pm | 2 +- t/www_listing.t | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 68445b3..82510b9 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -320,7 +320,7 @@ sub modified ($) { chomp $oid; my $buf = cat_file($self, $oid) or next; $$buf =~ /^committer .*?> ([0-9]+) [\+\-]?[0-9]+/sm or next; - my $cmt_time = $1; + my $cmt_time = $1 + 0; $modified = $cmt_time if $cmt_time > $modified; } $modified || time; diff --git a/t/www_listing.t b/t/www_listing.t index 2741e1b..1f29298 100644 --- a/t/www_listing.t +++ b/t/www_listing.t @@ -96,6 +96,7 @@ SKIP: { $body .= $buf; } IO::Uncompress::Gunzip::gunzip(\$body => \$tmp); + unlike($tmp, qr/"modified":\s*"/, 'modified is an integer'); my $manifest = $json->decode($tmp); ok(my $clone = $manifest->{'/alt'}, '/alt in manifest'); is($clone->{owner}, 'lorelei', 'owner set'); -- EW