Closed p5pRT closed 19 years ago
This happens on ithread 5.8.x perls:
% perl -Moverload -MTest::Simple=no_plan -e'BEGIN{overload::constant(q=>sub{[]})}ok(1\,"x")' Invalid value for shared scalar at /usr/share/perl/5.8/Test/Builder.pm line 319. WHOA! Somehow you got a different number of results than tests ran! This should never happen! Please contact the author immediately! END failed--call queue aborted.
This bug manifested in i18n-0.04's tests\, which I worked around in i18n-0.05 by appending |'' to names to force stringification.
Somehow the shared %result hash does not like being assigned a {name} that contains a reference produced by overloading constants.
On Thu\, Jul 22\, 2004 at 09:12:21PM -0000\, Autrijus Tang wrote:
This happens on ithread 5.8.x perls:
% perl -Moverload -MTest::Simple=no_plan -e'BEGIN{overload::constant(q=>sub{[]})}ok(1\,"x")' Invalid value for shared scalar at /usr/share/perl/5.8/Test/Builder.pm line 319. WHOA! Somehow you got a different number of results than tests ran! This should never happen! Please contact the author immediately! END failed--call queue aborted.
This bug manifested in i18n-0.04's tests\, which I worked around in i18n-0.05 by appending |'' to names to force stringification.
Somehow the shared %result hash does not like being assigned a {name} that contains a reference produced by overloading constants.
Its simpler than that. You can't store an unshared ref in a shared structure; eg
use threads; use threads::shared; my $h = {}; share($h); $h->{foo} = [];
outputs
Invalid value for shared scalar at /tmp/p line 7.
I don't know enough about Test::Builder etc to know whether it should be responible for stringifying any values before assigning them to $result->{name}\, or whether overloading q() to return a ref is a case of 'doctor it hurts when I do this'.
Dave.
-- You never really learn to swear until you learn to drive.
The RT System itself - Status changed from 'new' to 'open'
On Fri\, Jul 23\, 2004 at 12:05:01AM +0100\, Dave Mitchell wrote:
I don't know enough about Test::Builder etc to know whether it should be responible for stringifying any values before assigning them to $result->{name}\, or whether overloading q() to return a ref is a case of 'doctor it hurts when I do this'.
from Test-Simple's Changes file:
0.48_02 Mon Jul 19 02:07:23 EDT 2004 * Overloaded objects as names now won't blow up under threads [rt.cpan.org 4218 and 4232]
I don't it's the case here but using overloaded objects for the names would not be so wise if those objects are (or depend on) the things you are testing. The right bug would leave with test failures and the wrong or no names on your tests\,
F
On 22 Jul 2004 23:04:53 -0000\, Dave Mitchell via RT \perlbug\-followup@​perl\.org wrote:
I don't know enough about Test::Builder etc to know whether it should be responible for stringifying any values before assigning them to $result->{name}\, or whether overloading q() to return a ref is a case of 'doctor it hurts when I do this'.
Well\, overloading q() to return a ref is how i18n.pm works. :-/
I think stringifying $todo and $name is the way to go. Attached is a patch that implements this solution.
Thanks\, /Autrijus/
Autrijus Tang wrote:
I don't know enough about Test::Builder etc to know whether it should be responible for stringifying any values before assigning them to $result->{name}\, or whether overloading q() to return a ref is a case of 'doctor it hurts when I do this'.
Well\, overloading q() to return a ref is how i18n.pm works. :-/
I think stringifying $todo and $name is the way to go. Attached is a patch that implements this solution.
Thanks\, applied as #23167 to bleadperl\, where I've also bumped the Test::Builder version to 0.17_01. Michael\, please integrate in your aegis repository :)
On Fri\, 23 Jul 2004 00:23:39 +0100\, Fergal Daly \fergal@​esatclear\.ie wrote:
I don't it's the case here but using overloaded objects for the names would not be so wise if those objects are (or depend on) the things you are testing. The right bug would leave with test failures and the wrong or no names on your tests\,
As a common reason to overload operators is to hide the fact that there's an object there at all\, the test author often will not even know that they're using an overloaded object as the name. As far as they know\, its just a string.
In the cases where they do know its not such a big deal to use the stringified version of the object you're testing as the name. Being left with no names or wrong names on tests is not very critical and you might just notice that its not working. Besides\, you're always working under the assumption that other parts of your system work while testing. This is nothing new.
On Thu\, 22 Jul 2004 20:17:58 -0700\, Autrijus Tang \autrijus@​gmail\.com wrote:
On 22 Jul 2004 23:04:53 -0000\, Dave Mitchell via RT \perlbug\-followup@​perl\.org wrote:
I don't know enough about Test::Builder etc to know whether it should be responible for stringifying any values before assigning them to $result->{name}\, or whether overloading q() to return a ref is a case of 'doctor it hurts when I do this'.
Well\, overloading q() to return a ref is how i18n.pm works. :-/
I think stringifying $todo and $name is the way to go. Attached is a patch that implements this solution.
Does 0.48_02 solve your problem?
Michael G Schwern wrote:
On Thu\, 22 Jul 2004 20:17:58 -0700\, Autrijus Tang \autrijus@​gmail\.com wrote:
On 22 Jul 2004 23:04:53 -0000\, Dave Mitchell via RT \perlbug\-followup@​perl\.org wrote:
I don't know enough about Test::Builder etc to know whether it should be responible for stringifying any values before assigning them to $result->{name}\, or whether overloading q() to return a ref is a case of 'doctor it hurts when I do this'.
Well\, overloading q() to return a ref is how i18n.pm works. :-/
I think stringifying $todo and $name is the way to go. Attached is a patch that implements this solution.
Does 0.48_02 solve your problem?
According to : http://mungus.schwern.org/cgi-bin/aeget/Test-Simple.1.49/lib/Test/Builder.pm it does. (although I don't know why offhand) BTW\, sync patches against blead welcome :)
(hey\, does everybody have a gmail account those days ?)
@rgs - Status changed from 'open' to 'resolved'
On Wed\, 28 Jul 2004 12:09:21 +0200\, Rafael Garcia-Suarez \rgarciasuarez@​mandrakesoft\.com wrote:
Does 0.48_02 solve your problem?
According to : http://mungus.schwern.org/cgi-bin/aeget/Test-Simple.1.49/lib/Test/Builder.pm it does. (although I don't know why offhand)
In the list of changes completed http://mungus.schwern.org/cgi-bin/aeget/Test-Simple.1.49/@@changes@completed
Look at change 14 http://mungus.schwern.org/cgi-bin/aeget/Test-Simple.1.49.C14/@@menu
And the code change is in Download -> patch (no metadata) http://mungus.schwern.org/cgi-bin/aeget/Test-Simple.1.49.C14/@@aepatch@compat=4.16
Migrated from rt.perl.org#30783 (status was 'resolved')
Searchable as RT30783$