Skip Menu |

This queue is for tickets about the Time-Piece CPAN distribution.

Report information
The Basics
Id: 130940
Status: open
Priority: 0/
Queue: Time-Piece

People
Owner: Nobody in particular
Requestors: wintermte [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Time::Piece crash in _strptime() XS function with localized months array
Date: Thu, 7 Nov 2019 17:55:58 -0600
To: bug-Time-Piece [...] rt.cpan.org
From: Daniell Freed <dan.freed [...] icloud.com>
Time::Piece::strptime() will crash when calling _strptime() if the month list is changed: cat timeliest.pl #!/usr/local/epic/EpicFebruary2020/bin/perl use Time::Piece; Time::Piece::mon_list(qw(January February March April May June July August September October November December)); my $t=Time::Piece->strptime("07 Nov 2019 21:29:37","%d %b %Y %H:%M:%S"); print $t->ymd."\n”; $ ./timetest.pl Error parsing time at /usr/local/epic/EpicFebruary2020/lib/perl/arch/Time/Piece.pm line 597. If line 4 is removed: $ ./timetest.pl 2019-11-07
On Thu Nov 07 19:05:14 2019, wintermte@gmail.com wrote: Show quoted text
> Time::Piece::strptime() will crash when calling _strptime() if the > month list is changed: > > cat timeliest.pl > #!/usr/local/epic/EpicFebruary2020/bin/perl > use Time::Piece; > > Time::Piece::mon_list(qw(January February March April May June July > August September October November December)); > my $t=Time::Piece->strptime("07 Nov 2019 21:29:37","%d %b %Y > %H:%M:%S"); > print $t->ymd."\n”; > > $ ./timetest.pl > Error parsing time at > /usr/local/epic/EpicFebruary2020/lib/perl/arch/Time/Piece.pm line 597. > > If line 4 is removed: > > $ ./timetest.pl > 2019-11-07
Thanks for the report. At first glance, this is probably mostly a documentation issue. 'mon_list' is for month short names, but in your case it has been given long names which then fails trying to parse against the short name flag ('%b'). The other problem is that there is no way to change the global that holds the full names: @FULLMON_LIST I'm actually not sure why there is no method for that. I've contemplated adding one in the past, perhaps I'll contemplate a little more and push a patch... Regards, Samuel Smith
Subject: Re: [rt.cpan.org #130940] Time::Piece crash in _strptime() XS function with localized months array
Date: Fri, 8 Nov 2019 09:44:51 -0600
To: bug-Time-Piece [...] rt.cpan.org
From: Dan Freed <wintermte [...] gmail.com>
It makes sense to update the docs and add a method to localize the long names. That said limiting the number of characters is very un-Perl like. If the point of this method (mon_list) is to create a localized version of the short names, then it still fails to provide that feature. For example, if I were to use the a list of Polish abbreviations it will still crash: Time::Piece::mon_list(qw(pol stycz luty mar kwiec maj czerw lip sierp wrzes paźdz listop grudz)); Of course there are many other languages that would cause a similar problem. Even if the extended ASCII characters are removed, it doesn't help. The buffer being used is just too small. There is a nice table of these abbreviations here: https://www.loc.gov/aba/pcc/conser/conserhold/Mosabbr.html On Thu, Nov 7, 2019 at 9:05 PM Samuel Smith via RT < bug-Time-Piece@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=130940 > > > On Thu Nov 07 19:05:14 2019, wintermte@gmail.com wrote:
> > Time::Piece::strptime() will crash when calling _strptime() if the > > month list is changed: > > > > cat timeliest.pl > > #!/usr/local/epic/EpicFebruary2020/bin/perl > > use Time::Piece; > > > > Time::Piece::mon_list(qw(January February March April May June July > > August September October November December)); > > my $t=Time::Piece->strptime("07 Nov 2019 21:29:37","%d %b %Y > > %H:%M:%S"); > > print $t->ymd."\n”; > > > > $ ./timetest.pl > > Error parsing time at > > /usr/local/epic/EpicFebruary2020/lib/perl/arch/Time/Piece.pm line 597. > > > > If line 4 is removed: > > > > $ ./timetest.pl > > 2019-11-07
> > > Thanks for the report. At first glance, this is probably mostly a > documentation issue. 'mon_list' is for month short names, but in your case > it has been given long names which then fails trying to parse against the > short name flag ('%b'). The other problem is that there is no way to change > the global that holds the full names: @FULLMON_LIST I'm actually not sure > why there is no method for that. I've contemplated adding one in the past, > perhaps I'll contemplate a little more and push a patch... > > Regards, > Samuel Smith > > >