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: AS16276 91.121.0.0/16 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 252491F670 for ; Fri, 22 Oct 2021 04:49:51 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1634878187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jcPpncCXZON3J1E3e9ynAQzMgIlFtcpO78ytqUWv7wc=; b=uYJ/+Lux0dreM+wmzMvyUFQD8zp83PjA2rPcEBtravo0xx5Z0opH5rOgEbGmFWvXRVvyie pIyi5Maym+5k9yRBIxgWLPVZCAyV7v4R1KKxxJagitWMe8mnftjTnfEY0pFKCBW3F3J4E4 dpzd7E3APP5c8fE7LeOF+16yZsx3FthCXf5OysdnJB659D8hmLtO9TCL5W66JatXdNL+D/ dAp5YJMIDEjyRmIADIuPGDsdqAeBhnvvayhWD8eoZ00K/xCrPnhgmVbGuayquhnp5sTvpx XxkY3Z2D093+jC3GzSUklu7To7OhNh0hWOvqimUCP5Vw/JfBmJ/QXJnvaw/amQ== From: Kyle Meyer To: meta@public-inbox.org Subject: [PATCH] wwwatomstream: call gmtime with scalar Date: Fri, 22 Oct 2021 00:49:35 -0400 Message-Id: <20211022044935.135785-1-kyle@kyleam.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com List-Id: When the gmtime() calls were moved from feed_entry() and atom_header() into feed_updated() in c447bbbd, @_ rather than a scalar was passed to gmtime(). As a result, feed values end up as "1970-01-01T00:00:00Z". Switch back to using a scalar argument to restore the correct timestamps. Fixes: c447bbbddb4ac8e1 ("wwwatomstream: simplify feed_update callers") --- lib/PublicInbox/WwwAtomStream.pm | 3 ++- t/psgi_v2.t | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index f60251b7..5d32294e 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -161,7 +161,8 @@ sub feed_entry { } sub feed_updated { - '' . strftime('%Y-%m-%dT%H:%M:%SZ', gmtime(@_)) . ''; + my ($t) = @_; + '' . strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($t)) . ''; } 1; diff --git a/t/psgi_v2.t b/t/psgi_v2.t index e0570682..64c1a8d3 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -92,6 +92,11 @@ my $client0 = sub { @bodies = ($res->content =~ /^(hello [^<]+)$/mg); is_deeply(\@bodies, [ "hello world!\n", "hello world\n" ], 'new.html ordering is chronological'); + + $res = $cb->(GET('/v2test/new.atom')); + my @dates = ($res->content =~ m!title>([^<]+)!g); + is_deeply(\@dates, [ "1993-10-02T00:01:00Z", "1993-10-02T00:00:00Z" ], + 'Date headers made it through'); }; test_psgi(sub { $www->call(@_) }, $client0); my $env = { TMPDIR => $tmpdir, PI_CONFIG => $cfgpath }; base-commit: 4cd7a78f3b8c03670e2d77675229472506eee1eb -- 2.33.1