BUG: Using DateTime overload in Template Toolkit causes process to exit() on 64-bit platforms
Perl
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
bug.pl

README

UPDATE 2012-01-13
=================

Andy Wardley seems to have solved the issue in the following commit:

https://github.com/abw/Template2/commit/cb1d793924ac105c188c2a573b7233621a6c5e24

Now I guess it's just a matter of waiting for a new release. 2.22_1 seems to
be golden.

-- robinsmidsrod

OLD INFORMATION BELOW
=====================

There seems to be a problem with DateTime being used by Template Toolkit.

I'm not sure if the bug is in Template or in DateTime, but so far I've been
able to narrow it down to the fact that the system that breaks has the
following characteristics:

 * Architecture is 64-bit
 * The XS stash is used
 * Distribution is Debian, Ubuntu, SuSE or MacOSX 10.4.11 (works on CentOS)

The problem is that when I try to access the DateTime variable in the
template, the process exits without any error message. It doesn't die in a
trappable way, it just exits.

References / more information:
https://rt.cpan.org/Ticket/Display.html?id=47032
https://rt.cpan.org/Ticket/Display.html?id=48020
https://rt.cpan.org/Ticket/Display.html?id=47929
http://github.com/abw/TT-XS-Stash-DateTime/tree/master
------------------------------------------------------------------------------

Confirmed working on:

From robin@smidsrod.no:

Description:    Ubuntu 10.04.3 LTS
Linux server 2.6.32-36-generic-pae #79-Ubuntu SMP Tue Nov 8 23:25:26 UTC
2011 i686 GNU/Linux
This is perl 5, version 12, subversion 2 (v5.12.2) built for i686-linux
POSIX version: 1.19
DateTime version: 0.66
Template version: 2.22_1 (commit bb1080b)
Template stash used: Template::Stash::XS

Description:    Ubuntu 10.04.3 LTS
Linux server 2.6.32-36-generic-pae #79-Ubuntu SMP Tue Nov 8 23:25:26 UTC
2011 i686 GNU/Linux
This is perl 5, version 14, subversion 0 (v5.14.0) built for i686-linux
POSIX version: 1.24
DateTime version: 0.72
Template version: 2.22_1 (commit bb1080b)
Template stash used: Template::Stash::XS

Description:    Ubuntu 8.10
Linux server 2.6.27-14-server #1 SMP Wed Apr 15 19:44:38 UTC 2009 i686 GNU/Linux
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
POSIX version: 1.13
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS

Description:    Ubuntu 8.04.2
Linux gm 2.6.24-24-generic #1 SMP Wed Apr 15 15:54:25 UTC 2009 i686 GNU/Linux
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
POSIX version: 1.09
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS

Description:    Ubuntu 8.04.2
Linux pf 2.6.24-24-server #1 SMP Wed Apr 15 15:41:09 UTC 2009 x86_64 GNU/Linux
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
POSIX version: 1.09
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash

OS: Windows Vista Business x64 w/ strawberry-perl 5.10.0.5
This is perl, v5.10.0 built for MSWin32-x86-multi-thread
POSIX version: 1.13
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS

From ash in #tt@irc.perl.org:

Description:	Ubuntu 9.04
Linux cambridge 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux
This is perl, v5.8.8 built for i686-linux
POSIX version: 1.09
DateTime version: 0.4302
Template version: 2.20
Template stash used: Template::Stash::XS

Description:	CentOS release 5.2 (Final)
Linux foo 2.6.18-92.1.6.el5xen #1 SMP Wed Jun 25 14:13:10 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
This is perl, v5.8.8 built for x86_64-linux-thread-multi
POSIX version: 1.09
DateTime version: 0.4304
Template version: 2.19
Template stash used: Template::Stash::XS

From Dave Howorth <dhoworth@mrc-lmb.cam.ac.uk>:

Description:    SuSE Linux 9.2 (x86-64)
Linux suse3 2.6.8-24.14-smp #1 SMP Tue Mar 29 09:27:43 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux
This is perl, v5.8.5 built for x86_64-linux-thread-multi
POSIX version: 1.08
DateTime version: 0.29
Template version: 2.14

From Frank Wiegand <frank@planet-interview.de>:

Description:    Debian GNU/Linux testing (squeeze)
Linux hal2 2.6.26-2-amd64 #1 SMP Fri Mar 27 04:02:59 UTC 2009 x86_64 GNU/Linux
This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
POSIX version: 1.13
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash

From jhannah in #perl-help@irc.perl.org:

OS: SUSE Linux Enterprise Server 10 (i586)
Linux dev 2.6.16.54-0.2.3-default #1 Thu Nov 22 18:32:07 UTC 2007 i686 i686 i386 GNU/Linux
This is perl, v5.8.8 built for i586-linux-thread-multi
POSIX version: 1.09
DateTime version: 0.42
Template version: 2.20
Template stash used: Template::Stash::XS

------------------------------------------------------------------------------

Confirmed broken on:

From robin@smidsrod.no:

Description:    Ubuntu 8.04.2
Linux pf 2.6.24-24-server #1 SMP Wed Apr 15 15:41:09 UTC 2009 x86_64 GNU/Linux
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
POSIX version: 1.09
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS

From Frank Wiegand <frank@planet-interview.de>:

Description:    Debian GNU/Linux testing (squeeze)
Linux hal2 2.6.26-2-amd64 #1 SMP Fri Mar 27 04:02:59 UTC 2009 x86_64 GNU/Linux
This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
POSIX version: 1.13
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS

From jhannah in #perl-help@irc.perl.org:

OS: MacOS X 10.4.11
Darwin Hannah-Mac-Mini-2.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
This is perl, v5.8.6 built for darwin-thread-multi-2level
POSIX version: 1.08
DateTime version: 0.50
Template version: 2.14
Template stash used: Template::Stash::XS

OS: SUSE Linux Enterprise Server 10.2 (x86_64)
Linux omares-omnihubdr1 2.6.16.60-0.21-smp #1 SMP Tue May 6 12:41:02 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux
This is perl, v5.8.8 built for x86_64-linux-thread-multi
POSIX version: 1.09
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS

------------------------------------------------------------------------------

Program run with Template->new({ DEBUG => 'all });

Version information:
Description:	Ubuntu 8.04.2
Linux pf 2.6.24-24-server #1 SMP Wed Apr 15 15:41:09 UTC 2009 x86_64 GNU/Linux
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
[Template::Provider] creating cache of unlimited slots for [ . ]
[Template::Service] process(SCALAR(0xc55ca0), HASH(0x604f10))
[Template::Context] template(SCALAR(0xc55ca0))
[Template::Context] asking providers for [SCALAR(0xc55ca0)] []
[Template::Provider] _load(SCALAR(0xc55ca0), <no alias>)
[Template::Provider] _compile(HASH(0xd71ef0), <no compfile>)
[Template::Parser] compiled main template document block:
sub {
    my $context = shift || die "template sub called without context\n";
    my $stash   = $context->stash;
    my $output  = '';
    my $_tt_error;
    
    eval { BLOCK: {
$output .=  "Starting POSIX test...\nCurrent timestamp: ";
#line 2 "input text"
$output .=  $context->debugging('msg', { 'line' => '2', 'text' => 'now_posix', 'file' => 'input text' }); ## DEBUG ##
#line 2 "input text"
$output .=  $stash->get('now_posix');
$output .=  "\nFinished POSIX test.\n";
    } };
    if ($@) {
        $_tt_error = $context->catch($@, \$output);
        die $_tt_error unless $_tt_error->type eq 'return';
    }

    return $output;
}
[Template::Service] PROCESS: Template::Document=HASH(0xeeeb50)
[Template::Context] process([ Template::Document=HASH(0xeeeb50) ], <no params>, <unlocalized>)
[Template::Context] template(Template::Document=HASH(0xeeeb50))
[Template::Service] process(SCALAR(0xc55cd0), HASH(0x604f10))
[Template::Context] template(SCALAR(0xc55cd0))
[Template::Context] asking providers for [SCALAR(0xc55cd0)] []
[Template::Provider] _load(SCALAR(0xc55cd0), <no alias>)
[Template::Provider] _compile(HASH(0xd71fd0), <no compfile>)
[Template::Parser] compiled main template document block:
sub {
    my $context = shift || die "template sub called without context\n";
    my $stash   = $context->stash;
    my $output  = '';
    my $_tt_error;
    
    eval { BLOCK: {
$output .=  "Starting DateTime test...\nCurrent timestamp: ";
#line 2 "input text"
$output .=  $context->debugging('msg', { 'line' => '2', 'text' => 'now_dt', 'file' => 'input text' }); ## DEBUG ##
#line 2 "input text"
$output .=  $stash->get('now_dt');
$output .=  "\nFinished DateTime test.\n";
    } };
    if ($@) {
        $_tt_error = $context->catch($@, \$output);
        die $_tt_error unless $_tt_error->type eq 'return';
    }

    return $output;
}
[Template::Service] PROCESS: Template::Document=HASH(0xeeead0)
[Template::Context] process([ Template::Document=HASH(0xeeead0) ], <no params>, <unlocalized>)
[Template::Context] template(Template::Document=HASH(0xeeead0))
POSIX version: 1.09
DateTime version: 0.50
Template version: 2.20
Template stash used: Template::Stash::XS
------------------------------
Starting POSIX test...
Current timestamp: 
## input text line 2 : [% now_posix %] ##
2009-06-17T13:06:53
Finished POSIX test.
The bug is present if you don't see any output after this line.