develooper Front page | perl.perl5.porters | Postings from January 2015

[perl #123698] 5.20 threaded regression: boolean.pm -truth option breaks string assignment in anonymous functions

Thread Previous
From:
David Golden
Date:
January 29, 2015 15:06
Subject:
[perl #123698] 5.20 threaded regression: boolean.pm -truth option breaks string assignment in anonymous functions
Message ID:
rt-4.0.18-18773-1422543985-1752.123698-75-0@perl.org
# New Ticket Created by  David Golden 
# Please include the string:  [perl #123698]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=123698 >


On Perl 5.20.X with threads, when boolean.pm uses the '-truth' option on import -- which replaces the interpreter's internal true/false values with boolean.pm objects -- we've seen a case where a string literal in an anonymous function becomes undefined, but only if a string assignment happens in the same function.

The attached program demonstrates the issue.

On Perl 5.18.2-threaded and Perl 5.20.0-not-threaded the output is:
    calling not_broken:
    what
    calling broken:
    what

On Perl 5.20.0-threaded and 5.20.1-threaded, the output is:
    calling not_broken:
    what
    calling broken:
    Use of uninitialized value0 in print at boolean-broken.pl line 12.

Discovered and discussed in these Github issues:
* https://github.com/Test-More/test-more/issues/546
* https://github.com/ingydotnet/boolean-pm/issues/8

While the change in 5.21.5 to prevent unlocking read-only values (which is what boolean.pm relies on) prevents boolean.pm from doing this trick, that the problem appears unreleated to true/false values, only affects threaded 5.20.X and occurs in such a peculiar circumstance suggests that there might be a deeper bug worth investigating.

My perl -V output is attached.
Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About