user/dev discussion of public-inbox itself
 help / color / Atom feed
From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 5/4] git: ensure ->modified returns an integer
Date: Mon, 10 Jun 2019 06:21:05 +0000
Message-ID: <20190610062105.rbfpfor7jf7x4trz@dcvr> (raw)
In-Reply-To: <20190609043105.22338-1-e@80x24.org>

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


      parent reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-09  4:31 [PATCH 0/4] grokmirror-compatible manifests Eric Wong (Contractor, The Linux Foundation)
2019-06-09  4:31 ` [PATCH 1/4] wwwlisting: allow hiding entries from manifest Eric Wong (Contractor, The Linux Foundation)
2019-06-09  4:31 ` [PATCH 2/4] wwwlisting: generate grokmirror-compatible manifest.js.gz Eric Wong (Contractor, The Linux Foundation)
2019-06-09  4:31 ` [PATCH 3/4] www: wire up /$INBOX/manifest.js.gz, too Eric Wong (Contractor, The Linux Foundation)
2019-06-09  4:31 ` [PATCH 4/4] www: support $INBOX/git/$EPOCH.git for v2 cloning Eric Wong (Contractor, The Linux Foundation)
2019-06-10  6:21 ` Eric Wong (Contractor, The Linux Foundation) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190610062105.rbfpfor7jf7x4trz@dcvr \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git