Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 124523
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: bitcardbmw [...] lsmod.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.2.9
Fixed in: 3.40



Subject: examples/populate_mailbox.pl should use 4-digit dates
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Message-ID: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 501
Download (untitled) / with headers
text/plain 501b
man Time::Local says Show quoted text
> Whenever possible, use an absolute four digit year instead.
With a detailed explanation about ambiguity of 2-digit dates above that. Please apply this fix: +++ Mail-IMAPClient-3.37/examples/populate_mailbox.pl @@ -107 +107 @@ sub seconds { - return timegm(0,$min,$hr,$dom,$moy-1,($yy>99?$yy-1900:$yy)) ; + return timegm(0,$min,$hr,$dom,$moy-1,($yy>999?$yy:$yy+1900)) ; 99?$yy:$yy+1900)) ;
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-1655-1520862904-1274.124523-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 508
Download (untitled) / with headers
text/plain 508b
This is old example code. However looking at things in context, we find that the regex matches a four-digit year via \d\d\d\d. Thus, I'd expect the desired behavior is to represent that year, be it 99, 999 or 1999 as the actual year matched. As such, I believe the proper "fix" would be to work around the attempts of Time::Local attempting to "do the right thing" by doing this: # allow year 0999 to be year 999, and year 0099 to be year 99 return timegm(0,$min,$hr,$dom,$moy-1,($yy>999?$yy:$yy-1900));
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-604-1520864042-1502.124523-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 130
Download (untitled) / with headers
text/plain 130b
Change I mentioned, will be in the next release along with this example code being run through perltidy and other format cleanups.
MIME-Version: 1.0
X-Spam-Status: No, score=-3.807 tagged_above=-99.9 required=10 tests=[AWL=1.314, BAYES_00=-1.9, FROM_OUR_RT=-4, SPF_NEUTRAL=0.779] autolearn=ham
In-Reply-To: <rt-4.0.18-1655-1520862905-1979.124523-6-0 [...] rt.cpan.org>
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-124523 [...] rt.cpan.org> <rt-4.0.18-16959-1519276892-86.124523-6-0 [...] rt.cpan.org> <rt-4.0.18-1655-1520862905-1979.124523-6-0 [...] rt.cpan.org>
Content-Language: en-US
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <4c1a8a60-3085-2870-4376-5cb7d1c29e37 [...] lsmod.de>
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -3.807
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 86A2D2401AC for <cpan-bug+Mail-IMAPClient [...] hipster.bestpractical.com>; Mon, 12 Mar 2018 10:23:26 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SGGRic7GcTGT for <cpan-bug+Mail-IMAPClient [...] hipster.bestpractical.com>; Mon, 12 Mar 2018 10:23:20 -0400 (EDT)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id ABC942400C2 for <bug-Mail-IMAPClient [...] rt.cpan.org>; Mon, 12 Mar 2018 10:23:20 -0400 (EDT)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 0887B11E029 for <bug-Mail-IMAPClient [...] rt.cpan.org>; Mon, 12 Mar 2018 07:23:19 -0700 (PDT)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id EA75011F02B for <bug-Mail-IMAPClient [...] rt.cpan.org>; Mon, 12 Mar 2018 07:23:15 -0700 (PDT)
Received: from golf.zq1.de (golf.zq1.de [144.76.96.7]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 3CB1211E029 for <bug-Mail-IMAPClient [...] rt.cpan.org>; Mon, 12 Mar 2018 07:23:14 -0700 (PDT)
Received: from golf.zq1.de (localhost [127.0.0.1]) by golf.zq1.de (Postfix) with ESMTP id 9681E60016 for <bug-Mail-IMAPClient [...] rt.cpan.org>; Mon, 12 Mar 2018 15:14:56 +0100 (CET)
Received: from [10.8.245.2] (unknown [10.8.245.2]) by golf.zq1.de (Postfix) with ESMTPS for <bug-Mail-IMAPClient [...] rt.cpan.org>; Mon, 12 Mar 2018 15:14:56 +0100 (CET)
Delivered-To: cpan-bug+Mail-IMAPClient [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #124523] examples/populate_mailbox.pl should use 4-digit dates
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
Return-Path: <bernhardout [...] lsmod.de>
X-Original-To: cpan-bug+Mail-IMAPClient [...] hipster.bestpractical.com
X-RT-Mail-Extension: mail-imapclient
Date: Mon, 12 Mar 2018 15:14:55 +0100
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_400_499 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SPF_PASS 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MOZILLA_USER_AGENT 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0, __zen.spamhaus.org_ERROR '
X-Spam-Level:
X-Greylist: delayed 495 seconds by postgrey-1.34 at xx1.develooper.com; Mon, 12 Mar 2018 07:23:15 PDT
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2018.3.12.141517
To: bug-Mail-IMAPClient [...] rt.cpan.org
Content-Transfer-Encoding: 8bit
From: "Bernhard M. Wiedemann" <bernhardout [...] lsmod.de>
RT-Message-ID: <rt-4.0.18-2624-1520864607-1994.124523-0-0 [...] rt.cpan.org>
Content-Length: 449
Download (untitled) / with headers
text/plain 449b
On 2018-03-12 14:55, Phil Pearl (Lobbes) via RT wrote: Show quoted text
> > # allow year 0999 to be year 999, and year 0099 to be year 99 > return timegm(0,$min,$hr,$dom,$moy-1,($yy>999?$yy:$yy-1900));
that could work, too. Though I expect that timegm was never intended to work with years < 1000 when the gregorian calendar was not yet invented. But luckily no emails exist from that time (until some genius imports historic letters from libraries into IMAP ;-)
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-16959-1519276892-86.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-29543-1544100744-891.124523-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 48
Release 3.40 is out with the fix for this issue.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.