Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


wb8tyw at qsl

May 21, 2008, 8:29 PM

Post #1 of 9 (191 views)
Permalink
07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails

A todo for VMS:

In blead[at]33891, 07arith.t is dying on test 11.

From the comments, it seems that it is expecting the _strptime function
(or something) to convert '2001-2-29' to '2001-3-1'.

Instead it is failing with the message "Error parsing time at
../lib/Time/Piece.pm line 615, <DATA> line 17.

-John
wb8tyw[at]qsl.net
Personal Opinion Only


h.m.brand at xs4all

May 21, 2008, 11:30 PM

Post #2 of 9 (178 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg" <wb8tyw[at]qsl.net>
wrote:

> A todo for VMS:
>
> In blead[at]33891, 07arith.t is dying on test 11.
>
> From the comments, it seems that it is expecting the _strptime function
> (or something) to convert '2001-2-29' to '2001-3-1'.

It's like this since a long time on all HP-UX too, and Steve P traced
it to be some XS problem last night.

Matt did not (yet) reply to my mails.

> Instead it is failing with the message "Error parsing time at
> ../lib/Time/Piece.pm line 615, <DATA> line 17.

--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/


craigberry at mac

May 22, 2008, 5:37 AM

Post #3 of 9 (174 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

At 8:30 AM +0200 5/22/08, H.Merijn Brand wrote:
>On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg" <wb8tyw[at]qsl.net>
>wrote:
>
>> A todo for VMS:
>>
>> In blead[at]33891, 07arith.t is dying on test 11.
>>
>> From the comments, it seems that it is expecting the _strptime function
>> (or something) to convert '2001-2-29' to '2001-3-1'.
>
>It's like this since a long time on all HP-UX too, and Steve P traced
>it to be some XS problem last night.
>
>Matt did not (yet) reply to my mails.
>
>> Instead it is failing with the message "Error parsing time at
> > ../lib/Time/Piece.pm line 615, <DATA> line 17.

I noticed this too. On VMS it boils down to passing to strptime a
time string for 29 February 2001, but unless I've lost some time
myself, 2001 was not a leap year, so it's not a valid time. The
standard for strptime is silent about what level of validation, if
any, should be done on the incoming time string.

Here's VMS:

$ perl -MTestInit -"MTime::Piece" -"E" "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
Error parsing time at -e line 1.

Here's Mac OS X:

% ./perl -MTestInit -"MTime::Piece" -E "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
56|34|12|1|2|101|4|59|0|0|0

If I'm reading this right, Mac OS X (and probably other BSDs) is
interpreting this as the first of March, which doesn't make much
sense to me, but may have a rationale behind it. In any case,
Time::Piece seems to depend on this non-portable behavior, and even,
as John noted, to be specifically testing for it.

--
________________________________________
Craig A. Berry
mailto:craigberry[at]mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser


h.m.brand at xs4all

May 22, 2008, 9:11 AM

Post #4 of 9 (174 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

On Thu, 22 May 2008 07:37:11 -0500, "Craig A. Berry"
<craigberry[at]mac.com> wrote:

> At 8:30 AM +0200 5/22/08, H.Merijn Brand wrote:
> >On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg" <wb8tyw[at]qsl.net>
> >wrote:
> >
> >> A todo for VMS:
> >>
> >> In blead[at]33891, 07arith.t is dying on test 11.
> >>
> >> From the comments, it seems that it is expecting the _strptime function
> >> (or something) to convert '2001-2-29' to '2001-3-1'.
> >
> >It's like this since a long time on all HP-UX too, and Steve P traced
> >it to be some XS problem last night.
> >
> >Matt did not (yet) reply to my mails.
> >
> >> Instead it is failing with the message "Error parsing time at
> > > ../lib/Time/Piece.pm line 615, <DATA> line 17.
>
> I noticed this too. On VMS it boils down to passing to strptime a
> time string for 29 February 2001, but unless I've lost some time
> myself, 2001 was not a leap year, so it's not a valid time. The
> standard for strptime is silent about what level of validation, if
> any, should be done on the incoming time string.
>
> Here's VMS:
>
> $ perl -MTestInit -"MTime::Piece" -"E" "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
> Error parsing time at -e line 1.
>
> Here's Mac OS X:
>
> % ./perl -MTestInit -"MTime::Piece" -E "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
> 56|34|12|1|2|101|4|59|0|0|0
>
> If I'm reading this right, Mac OS X (and probably other BSDs) is
> interpreting this as the first of March, which doesn't make much
> sense to me, but may have a rationale behind it. In any case,
> Time::Piece seems to depend on this non-portable behavior, and even,
> as John noted, to be specifically testing for it.

I RT'd it:
http://rt.cpan.org//Ticket/Display.html?id=36106

--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/


steve at fisharerojo

May 22, 2008, 11:50 AM

Post #5 of 9 (170 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

On Thu, May 22, 2008 at 7:37 AM, Craig A. Berry <craigberry[at]mac.com> wrote:
> At 8:30 AM +0200 5/22/08, H.Merijn Brand wrote:
>>On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg" <wb8tyw[at]qsl.net>
>>wrote:
>>
>>> A todo for VMS:
>>>
>>> In blead[at]33891, 07arith.t is dying on test 11.
>>>
>>> From the comments, it seems that it is expecting the _strptime function
>>> (or something) to convert '2001-2-29' to '2001-3-1'.
>>
>>It's like this since a long time on all HP-UX too, and Steve P traced
>>it to be some XS problem last night.
>>
>>Matt did not (yet) reply to my mails.
>>
>>> Instead it is failing with the message "Error parsing time at
>> > ../lib/Time/Piece.pm line 615, <DATA> line 17.
>
> I noticed this too. On VMS it boils down to passing to strptime a
> time string for 29 February 2001, but unless I've lost some time
> myself, 2001 was not a leap year, so it's not a valid time. The
> standard for strptime is silent about what level of validation, if
> any, should be done on the incoming time string.
>
> Here's VMS:
>
> $ perl -MTestInit -"MTime::Piece" -"E" "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
> Error parsing time at -e line 1.
>
> Here's Mac OS X:
>
> % ./perl -MTestInit -"MTime::Piece" -E "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
> 56|34|12|1|2|101|4|59|0|0|0
>
> If I'm reading this right, Mac OS X (and probably other BSDs) is
> interpreting this as the first of March, which doesn't make much
> sense to me, but may have a rationale behind it. In any case,
> Time::Piece seems to depend on this non-portable behavior, and even,
> as John noted, to be specifically testing for it.
>

Actually, there isn't any non-portable stuff happening regarding
dates. The _strptime routine is supposed to see 2001-2-29 and realize
that you really mean 2001-3-1. For some reason, the code works pretty
much everywhere else, but HP-UX and VMS. Where the exact failure is,
I haven't found exactly, but once I get off my lazy backside, I'll
have an answer.

Steve Peters
steve[at]fisharerojo.org


steve at fisharerojo

May 22, 2008, 1:03 PM

Post #6 of 9 (170 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

On Thu, May 22, 2008 at 1:50 PM, Steve Peters <steve[at]fisharerojo.org> wrote:
> On Thu, May 22, 2008 at 7:37 AM, Craig A. Berry <craigberry[at]mac.com> wrote:
>> At 8:30 AM +0200 5/22/08, H.Merijn Brand wrote:
>>>On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg" <wb8tyw[at]qsl.net>
>>>wrote:
>>>
>>>> A todo for VMS:
>>>>
>>>> In blead[at]33891, 07arith.t is dying on test 11.
>>>>
>>>> From the comments, it seems that it is expecting the _strptime function
>>>> (or something) to convert '2001-2-29' to '2001-3-1'.
>>>
>>>It's like this since a long time on all HP-UX too, and Steve P traced
>>>it to be some XS problem last night.
>>>
>>>Matt did not (yet) reply to my mails.
>>>
>>>> Instead it is failing with the message "Error parsing time at
>>> > ../lib/Time/Piece.pm line 615, <DATA> line 17.
>>
>> I noticed this too. On VMS it boils down to passing to strptime a
>> time string for 29 February 2001, but unless I've lost some time
>> myself, 2001 was not a leap year, so it's not a valid time. The
>> standard for strptime is silent about what level of validation, if
>> any, should be done on the incoming time string.
>>
>> Here's VMS:
>>
>> $ perl -MTestInit -"MTime::Piece" -"E" "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>> Error parsing time at -e line 1.
>>
>> Here's Mac OS X:
>>
>> % ./perl -MTestInit -"MTime::Piece" -E "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>> 56|34|12|1|2|101|4|59|0|0|0
>>
>> If I'm reading this right, Mac OS X (and probably other BSDs) is
>> interpreting this as the first of March, which doesn't make much
>> sense to me, but may have a rationale behind it. In any case,
>> Time::Piece seems to depend on this non-portable behavior, and even,
>> as John noted, to be specifically testing for it.
>>
>
> Actually, there isn't any non-portable stuff happening regarding
> dates. The _strptime routine is supposed to see 2001-2-29 and realize
> that you really mean 2001-3-1. For some reason, the code works pretty
> much everywhere else, but HP-UX and VMS. Where the exact failure is,
> I haven't found exactly, but once I get off my lazy backside, I'll
> have an answer.
>

I hate it when the answer is right in front of my eyes.

There is code for an C based strptime() implementation, but it is only
used for Windows and QNX. VMS and HP-UX are using their system
strptime(), as are Mac OS X, Linux, Solaris, etc. The VMS and HP-UX
ones seem to be a little more strict regarding valid dates. The
solution here is to make HP-UX and VMS use Time::Piece's C-based
strptime(). I have it working in a hackish sort of way right now, but
won't have time to clean it up until later this evening.

Steve Peters
steve[at]fisharerojo.org


craigberry at mac

May 22, 2008, 1:07 PM

Post #7 of 9 (170 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

At 1:50 PM -0500 5/22/08, Steve Peters wrote:

>
> > Here's VMS:
>>
>> $ perl -MTestInit -"MTime::Piece" -"E" "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>> Error parsing time at -e line 1.
>>
>> Here's Mac OS X:
>>
>> % ./perl -MTestInit -"MTime::Piece" -E "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>> 56|34|12|1|2|101|4|59|0|0|0
>>
>> If I'm reading this right, Mac OS X (and probably other BSDs) is
>> interpreting this as the first of March, which doesn't make much
>> sense to me, but may have a rationale behind it. In any case,
>> Time::Piece seems to depend on this non-portable behavior, and even,
>> as John noted, to be specifically testing for it.
>>
>
>Actually, there isn't any non-portable stuff happening regarding
>dates. The _strptime routine is supposed to see 2001-2-29 and realize
>that you really mean 2001-3-1.

Why on earth would it think that? Is 2001-2-30 interpreted as 2001-3-2?

>For some reason, the code works pretty
>much everywhere else, but HP-UX and VMS.

Because it's not the same code. As far as I can tell, it's just
calling the C library's strptime() and however that interprets
2001-2-29 determines what happens.* Since 2001-2-29 is an invalid
date, returning an error seems to me like the right thing to do, and
that's what VMS and apparently HP-UX do. But different implementors
have had different ideas, and as I mentioned before, no standard I
can find says anything about what conditions should be considered
error conditions. For systems that guess that you meant something
other than what you said, is there any documentation that describes
the intention? Do we even know that interpreting 2001-2-29 as
2001-3-1 is intentional and not just an untrapped error?

* The exception to that is that on Win32 the PowerDog strptime()
implementation is used by Time::Piece, and this is the same
implementation used by the BSDs.


--
________________________________________
Craig A. Berry
mailto:craigberry[at]mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser


steve at fisharerojo

May 22, 2008, 2:14 PM

Post #8 of 9 (169 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

On Thu, May 22, 2008 at 3:07 PM, Craig A. Berry <craigberry[at]mac.com> wrote:
> At 1:50 PM -0500 5/22/08, Steve Peters wrote:
>
>>
>> > Here's VMS:
>>>
>>> $ perl -MTestInit -"MTime::Piece" -"E" "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>>> Error parsing time at -e line 1.
>>>
>>> Here's Mac OS X:
>>>
>>> % ./perl -MTestInit -"MTime::Piece" -E "say join '|', Time::Piece::_strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S');"
>>> 56|34|12|1|2|101|4|59|0|0|0
>>>
>>> If I'm reading this right, Mac OS X (and probably other BSDs) is
>>> interpreting this as the first of March, which doesn't make much
>>> sense to me, but may have a rationale behind it. In any case,
>>> Time::Piece seems to depend on this non-portable behavior, and even,
>>> as John noted, to be specifically testing for it.
>>>
>>
>>Actually, there isn't any non-portable stuff happening regarding
>>dates. The _strptime routine is supposed to see 2001-2-29 and realize
>>that you really mean 2001-3-1.
>
> Why on earth would it think that? Is 2001-2-30 interpreted as 2001-3-2?
>

Actually, yes, it seems to.

steve[at]picard:~/perl-current$ ./perl -Ilib -"MTime::Piece" -"E" "say
join '|', Time::Piece::_strptime('2001-2-30 12:34:56', '%Y-%m-%d
%H:%M:%S');"
56|34|12|2|2|101|5|60|0|0|0

I get identical answers on Win32, Solaris, Cygwin and Linux.

>>For some reason, the code works pretty
>>much everywhere else, but HP-UX and VMS.
>
> Because it's not the same code. As far as I can tell, it's just
> calling the C library's strptime() and however that interprets
> 2001-2-29 determines what happens.* Since 2001-2-29 is an invalid
> date, returning an error seems to me like the right thing to do, and
> that's what VMS and apparently HP-UX do. But different implementors
> have had different ideas, and as I mentioned before, no standard I
> can find says anything about what conditions should be considered
> error conditions. For systems that guess that you meant something
> other than what you said, is there any documentation that describes
> the intention? Do we even know that interpreting 2001-2-29 as
> 2001-3-1 is intentional and not just an untrapped error?
>
> * The exception to that is that on Win32 the PowerDog strptime()
> implementation is used by Time::Piece, and this is the same
> implementation used by the BSDs.
>

It would seem to me that an error is correct, but, obviously, that's
not how they were implemented anywhere except on HP-UX, VMS, and Tru64
(see http://www.nntp.perl.org/group/perl.daily-build.reports/2008/05/msg55675.html).
So, saying its an untrapped error seems unlikely. It just seems that
HP-UX, VMS, and Tru64 are the exception rather than the rule.

Steve Peters
steve[at]fisharerojo.org


gisle at activestate

May 22, 2008, 3:11 PM

Post #9 of 9 (161 views)
Permalink
Re: 07arith.t failing as _strptime('2001-2-29 12:34:56', '%Y-%m-%d %H:%M:%S') fails [In reply to]

On May 22, 2008, at 08:30, H.Merijn Brand wrote:

> On Wed, 21 May 2008 22:29:13 -0500, "John E. Malmberg"
> <wb8tyw[at]qsl.net>
> wrote:
>
>> A todo for VMS:
>>
>> In blead[at]33891, 07arith.t is dying on test 11.
>>
>> From the comments, it seems that it is expecting the _strptime
>> function
>> (or something) to convert '2001-2-29' to '2001-3-1'.
>
> It's like this since a long time on all HP-UX too, and Steve P traced
> it to be some XS problem last night.
>
> Matt did not (yet) reply to my mails.

I've provided a patch to Matt for this failure a while ago and he has
confirmed to have applied it to his SVN repo, so it will be in 1.14
when it's released.

--Gisle

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.