Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Locale-Maketext CPAN distribution.

Report information
The Basics
Id: 25877
Status: resolved
Priority: 0/
Queue: Locale-Maketext

People
Owner: ferreira [...] shoo.cpan.org
Requestors: imacat [...] mail.imacat.idv.tw
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.10
Fixed in: 1.15_01

Attachments
Locale-Maketext-1.10-2ndvalue.diff.asc



Subject: $value Not Set After Second Call to failure_handler_auto()
Dear Andy Lester, Hi. This is imacat from Taiwan. I'm the author of Locale::Maketext::Gettext. I was reading bug#33938. I found that failure_handler_auto() still won't work after applying this patch while I was trying to apply this patch on Locale::Maketext and incorporate it into my own Locale::Maketext::Gettext. At this line: $lex->{$phrase} ||= ($value = $handle->_compile($phrase)); After second call with a same $phrase, $lex->{$phrase} has a true value so that the following parts will not be run, resulting $value not get set at all. A simple test showing this is attached below. I also attached a simple patch that should fix this. Hope that this helps. Please tell me if there is any problem. Thank you. ====== imacat@rinse /tmp % tar xzf Locale-Maketext-1.10.tar.gz imacat@rinse /tmp % cd Locale-Maketext-1.10/lib/Locale imacat@rinse lib/Locale % patch < /tmp/bug33938.patch patching file Maketext.pm Hunk #1 succeeded at 127 (offset 1 line). Hunk #2 succeeded at 135 (offset 1 line). Hunk #3 succeeded at 177 (offset 1 line). imacat@rinse lib/Locale % cat /tmp/test.pl #! /usr/bin/perl -w use strict; use lib qw(/tmp/Locale-Maketext-1.10/lib); my $lh = TL10N->get_handle("en"); $lh->fail_with('failure_handler_auto'); print $lh->maketext("abcd") . "\n"; print $lh->maketext("abcd") . "\n"; package TL10N; use base qw(Locale::Maketext); package TL10N::en; use base qw(Locale::Maketext); imacat@rinse lib/Locale % /tmp/test.pl abcd Use of uninitialized value in concatenation (.) or string at /tmp/test.pl line 7. imacat@rinse lib/Locale % =======
Subject: Locale-Maketext-1.10-2ndvalue.diff.asc
Download Locale-Maketext-1.10-2ndvalue.diff.asc
application/octet-stream 804b

Message body not shown because it is not plain text.

From: HANK [...] cpan.org
Here's a patch against 1.11_01 moseley@bumby:~/Locale-Maketext-1.11_01$ diff lib/Locale/Maketext.pm.orig lib/Locale/Maketext.pm 134,135c134,138 < my $value; < $lex->{$phrase} ||= ($value = $handle->_compile($phrase)); --- Show quoted text
> # Compile phase, if not already in failure_lex > $lex->{$phrase} ||= $handle->_compile($phrase); > > > my $value = $lex->{$phrase};
139a143 Show quoted text
>
Still important! And i think this is not a whislist, its a bug! The patch works well, plz include in next release! On Sa. 02. Jun. 2007, 21:19:17, HANK wrote: Show quoted text
> Here's a patch against 1.11_01 > > moseley@bumby:~/Locale-Maketext-1.11_01$ diff > lib/Locale/Maketext.pm.orig lib/Locale/Maketext.pm > 134,135c134,138 > < my $value; > < $lex->{$phrase} ||= ($value = $handle->_compile($phrase)); > ---
> > # Compile phase, if not already in failure_lex > > $lex->{$phrase} ||= $handle->_compile($phrase); > > > > > > my $value = $lex->{$phrase};
> 139a143
> >
This should be resolved at 1.13_80 which is on its way to CPAN. I hope to soon promote that to a stable release.
On Tue Jun 23 14:16:49 2009, FERREIRA wrote: Show quoted text
> This should be resolved at 1.13_80 which is on its way to CPAN. I
hope Show quoted text
> to soon promote that to > a stable release.
A minor note on this that '$lex' seems to be a useless copy: my $lex = $handle->{'failure_lex'}; my $value = $lex->{$phrase} ||= $handle->_compile($phrase); why not my $value = $handle->{'failure_lex'}{$phrase} ||= $handle- Show quoted text
>_compile($phrase);
Also for [read/maintain]ability why not: if (!exists $handle->{'failure_lex'}{$phrase}) { $handle->{'failure_lex'}{$phrase} = $handle->_compile($phrase); } my $value = $handle->{'failure_lex'}{$phrase}; then: - $handle->{'failure_lex'} is autovivified (no need to ||= {} it) - it is very easy for anyone to look at it and understand what is happening - $value is always set (or maybe just use $handle- Show quoted text
>{'failure_lex'}{$phrase} instead of $value, not too big a deal really)
sorry, I had the "still resolved" option checked and it changed it to open, when I try to re-resolve it I get "permission denied", this can safely be re- closed :)
trying 'resolved' with adding a note to see if I can get it to go...
Accepted by p5p for blead. commit e9c9ffcae4a8b5820dabb04674b85bb5195fcfc4 Author: Todd Rinaldo <toddr@cpanel.net> Date: Sat Sep 25 11:20:10 2010 -0700 This patch with tests resolves CPAN RT #40727. The issue is an infi- nite loop during _compile when working with tainted values. The issue was triggered by perlbugs 60378,27344. Both have been resolved but they are still broken in perl 5.12.x and earlier. The patch simply assigns $_[1] to a variable and uses that from then on.
1.15_02 is the RC for 1.16. No issues so far. closing ticket.