Closed p5pRT closed 13 years ago
This is a bug report for perl from slaven@rezic.de\, generated with the help of perlbug 1.39 running under perl 5.13.11.
The problem is described in https://rt.cpan.org/Ticket/Display.html?id=66876
The author (MSCHWERN) suggests that the breakage could be caused by bleadperl and should be reported here.
Regards\, Slaven
Flags: category=core severity=low
Site configuration information for perl 5.13.11:
Configured by cpansand at Wed Mar 23 09:22:59 CET 2011.
Summary of my perl5 (revision 5 version 13 subversion 11) configuration: Commit id: 167630b6ab7e291cbd4f89943a3aec8d6a1ecbfc Platform: osname=freebsd\, osvers=8.0-release\, archname=i386-freebsd uname='freebsd biokovo.herceg.de 8.0-release freebsd 8.0-release #0: sat nov 21 15:48:17 utc 2009 root@almeida.cse.buffalo.edu:usrobjusrsrcsysgeneric i386 ' config_args='-ds -e -Uversiononly -Dinstallusrbinperl=n -Dusedevel -Dprefix=/home/cpansand/var/ctps/2pre5140/install/perl-167630b6ab7e291cbd4f89943a3aec8d6a1ecbfc' hint=recommended\, useposix=true\, d_sigaction=define useithreads=undef\, usemultiplicity=undef useperlio=define\, d_sfio=undef\, uselargefiles=define\, usesocks=undef use64bitint=undef\, use64bitall=undef\, uselongdouble=undef usemymalloc=n\, bincompat5005=undef Compiler: cc='cc'\, ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'\, optimize='-O'\, cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion=''\, gccversion='4.2.1 20070719 [FreeBSD]'\, gccosandvers='' intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12 ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8 alignbytes=4\, prototype=define Linker and Libraries: ld='cc'\, ldflags ='-Wl\,-E -fstack-protector -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lcrypt -lutil -lc perllibs=-lm -lcrypt -lutil -lc libc=\, so=so\, useshrplib=false\, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags=' ' cccdlflags='-DPIC -fPIC'\, lddlflags='-shared -L/usr/local/lib -fstack-protector'
Locally applied patches:
@INC for perl 5.13.11: /home/cpansand/var/ctps/2pre5140/install/perl-167630b6ab7e291cbd4f89943a3aec8d6a1ecbfc/lib/site_perl/5.13.11/i386-freebsd /home/cpansand/var/ctps/2pre5140/install/perl-167630b6ab7e291cbd4f89943a3aec8d6a1ecbfc/lib/site_perl/5.13.11 /home/cpansand/var/ctps/2pre5140/install/perl-167630b6ab7e291cbd4f89943a3aec8d6a1ecbfc/lib/5.13.11/i386-freebsd /home/cpansand/var/ctps/2pre5140/install/perl-167630b6ab7e291cbd4f89943a3aec8d6a1ecbfc/lib/5.13.11 .
Environment for perl 5.13.11: HOME=/home/e/eserte LANG (unset) LANGUAGE (unset) LC_ALL=de_DE.ISO8859-1 LC_CTYPE=de_DE.ISO8859-1 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/bin:/usr/bin:/bin:/usr/gnu/bin:/usr/TeX/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/pilot/bin:/home/e/eserte/bin/FreeBSD:/home/e/eserte/bin/sh:/home/e/eserte/bin:/usr/X11R6/bin:/usr/X11/bin:/usr/X386/bin:/usr/games:/home/e/eserte/devel PERLDOC=-MPod::Perldoc::ToTextOverstrike PERL_BADLANG (unset) PERL_HTML_DISPLAY_CLASS=HTML::Display::Mozilla SHELL=/bin/tcsh
On Sat Mar 26 05:33:43 2011\, slaven@rezic.de wrote:
----------------------------------------------------------------- The problem is described in https://rt.cpan.org/Ticket/Display.html?id=66876
The author (MSCHWERN) suggests that the breakage could be caused by bleadperl and should be reported here.
This was caused by the following commit:
commit f07ec6dd59215a56bc1159449a9631be7a02a94d Author: Zefram \zefram@​fysh\.org Date: Wed Oct 13 19:05:19 2010 +0100
remove filter inheritance option from lex_start
The only uses of lex_start that had the new_filter parameter false\,
to make the new lexer context share source filters with the previous
lexer context\, were uses with rsfp null\, which therefore never invoked
source filters. Inheriting source filters from a logically unrelated
file seems like a silly idea anyway.
Whatās happening is that Semi::Semicolonsā test suite is doing
BEGIN{ use_ok('Semi::Semicolons'); }
which enables the source filter for the rest of the test script.
Test::More implements use_ok with a āuseā statement inside a string eval\, so that line is a bit like:
BEGIN{ eval "use Semi::Semicolons" }
This now fails to activate the source filter because the eval and the test script are no longer able to share the same source filter space. When that commit messages says that ārsfp [was] null\, which therefore never invoked source filtersā\, it fails to take into account that\, even though source filters do not apply to string evals\, they can still allow filters to be propagated *back* to the real file currently being compiled.
To resolve this\, either we can just revert that patch (which would be an API change\, since that commit came just a few commits before lex_startās being made public)\, or we can revert it\, rename lex_start to something else\, and make a lex_start macro with the current API.
The RT System itself - Status changed from 'new' to 'open'
Father Chrysostomos via RT wrote:
it fails to take into account that\, even
though source filters do not apply to string evals\, they can still allow filters to be propagated *back* to the real file currently being compiled.
Eww. Let's not restore that behaviour. Change whatever was relying on it.
-zefram
On 28 March 2011 12:39\, Zefram \zefram@​fysh\.org wrote:
Father Chrysostomos via RT wrote:
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā it fails to take into account that\, even though source filters do not apply to string evals\, they can still allow filters to be propagated *back* to the real file currently being compiled.
Eww. Ā Let's not restore that behaviour. Ā Change whatever was relying on it.
I would second that; anything that makes source filters a bit less intrusive is good. However I suppose that this needs an entry in perldelta / incompatible changes.
Father Chrysostomos via RT wrote:
Test::More implements use_ok with a ???use??? statement inside a string eval\, so that line is a bit like:
It occurred to me that not only does this now run into trouble with source filters but it'll also\, regardless of the recent source filter change\, run into trouble with anything that interacts with the compilation context. Any import method that sets up a lexically-scoped effect will influence the lexical scope of the string eval\, not the lexical scope of the BEGIN{use_ok}. Likewise\, any source injection into the parsing context\, triggered from the import method\, will affect the eval rather than the main code. Example:
$ perl -le 'use Test::More tests => 2; BEGIN { use_ok("strict"\, "vars"); } $z; ok 1;' 1..2 ok 1 - use strict; ok 2
That ought to fail at compile time\, like this:
$ perl -le 'use Test::More tests => 2; use strict "vars"; BEGIN { ok 1; } $z; ok 1;' 1..2 ok 1 Global symbol "$z" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. # Looks like you planned 2 tests but ran 1. # Looks like your test exited with 255 just after 1.
So I reckon use_ok is seriously broken\, and the core change has just made this brokenness show up in a new situation. use_ok needs to do the require and import itself\, without any string eval. The core of it is something like:
sub my_use($;@) { my $module = $_[0]; (my $filename = $module.".pm") =~ s!::!/!g; require($filename); goto &{$module->can("import")}; }
-zefram
On Tue\, Mar 29\, 2011 at 12:16:33PM +0100\, Zefram wrote:
So I reckon use_ok is seriously broken\, and the core change has just made this brokenness show up in a new situation. use_ok needs to do the require and import itself\, without any string eval. The core of it is something like:
sub my\_use\($;@​\) \{ my $module = $\_\[0\]; \(my $filename = $module\."\.pm"\) =~ s\!​::\!/\!g; require\($filename\); goto &\{$module\->can\("import"\)\}; \}
But of course\, if does the goto (to get the correct caller lexical scope)\, then it's too late to print 'not ok' if the import fails (e.g. if it dies).
So I suspect that use_ok() is fundamentally unsuitable (and not fixable) for modules that affect the callers lexical scope.
In which case\, it's probably best to just document this limitation in Test::More\, and suggest to Semi-Semicolons's maintainer to avoid use_ok().
If this is acceptable\, then this ticket ceases to be a 5.14 blocker.
-- Lear: Dost thou call me fool\, boy? Fool: All thy other titles thou hast given away; that thou wast born with.
Dave Mitchell wrote:
But of course\, if does the goto (to get the correct caller lexical scope)\, then it's too late to print 'not ok' if the import fails (e.g. if it dies).
True\, but it's not a disaster if we change use_ok() to work this way. It can print "ok" or "not ok" based on whether the require() succeeds\, and then chain the import. If import dies then the test script dies\, which should adequately signal failure. The only real losers are test scripts that relied on being able to continue with other tests after use_ok()\, but that must be a rare usage: usually the later tests depend on the effects of the import and so will fail anyway.
So I suspect that use_ok() is fundamentally unsuitable (and not fixable) for modules that affect the callers lexical scope.
I think what I outlined above is a better tradeoff than leaving use_ok() unsuitable for anything with lexical effect. But probably not a change to make before 5.14.
In which case\, it's probably best to just document this limitation in Test::More\, and suggest to Semi-Semicolons's maintainer to avoid use_ok().
I think this is the best approach for 5.14.
-zefram
On Wed Mar 30 07:32:21 2011\, zefram@fysh.org wrote:
Dave Mitchell wrote:
But of course\, if does the goto (to get the correct caller lexical scope)\, then it's too late to print 'not ok' if the import fails (e.g. if it dies).
True\, but it's not a disaster if we change use_ok() to work this way. It can print "ok" or "not ok" based on whether the require() succeeds\, and then chain the import. If import dies then the test script dies\, which should adequately signal failure. The only real losers are test scripts that relied on being able to continue with other tests after use_ok()\, but that must be a rare usage: usually the later tests depend on the effects of the import and so will fail anyway.
So I suspect that use_ok() is fundamentally unsuitable (and not fixable) for modules that affect the callers lexical scope.
I think what I outlined above is a better tradeoff than leaving use_ok() unsuitable for anything with lexical effect. But probably not a change to make before 5.14.
This is actually more tricky than you suggest\, as Test::More currently supports use_ok("Exporter 5.57") syntax.
In which case\, it's probably best to just document this limitation in Test::More\, and suggest to Semi-Semicolons's maintainer to avoid use_ok().
I think this is the best approach for 5.14.
Do you realise there are twenty distributions affected?
Acme::Base64 Acme::ComeFrom Acme::Hyperindex Acme::Lingua::NIGERIAN Acme::Pythonic Call::Immediate Data::Dumper::Simple Filter::Arguments Filter::BoxString Filter::CommaEquals Filter::Indent::HereDoc Filter::Object::Simple Filter::Template For::Else Lingua::tlhInganHol::yIghun Net::IP::Match Perl6::Attributes Semi::Semicolons Sub::Signatures Test::Standalone
I would suggest that we re-instate the filter-sharing capability (see the attached patch) as a stopgap measure. We could always revert it after 5.14.
(Slaven\, Iām forwarding this to you\, as these distributions are on your list.)
From 2f1624fb1b763c9899594d1671941477b7df2091 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos \sprout@​cpan\.org Date: Tue\, 29 Mar 2011 08:33:30 -0700
[perl #87064] eval no longer shares filters
Before this commit:
commit f07ec6dd59215a56bc1159449a9631be7a02a94d Author: Zefram \zefram@​fysh\.org Date: Wed Oct 13 19:05:19 2010 +0100
remove filter inheritance option from lex_start
The only uses of lex_start that had the new_filter parameter false\, to make the new lexer context share source filters with the previous lexer context\, were uses with rsfp null\, which therefore never invoked source filters. Inheriting source filters from a logically unrelated file seems like a silly idea anyway.
string evals could inherit the same source filter space as the cur- rently compiling code. Despite what the quoted commit message says\, sharing source filters allows filters to be inherited in both direc- tions: A source filter created when the eval is being compiled also applies to the file with which it is sharing its space.
There are at least 20 CPAN distributions relying on this behaviour. So this commit restores the source-filter-sharing capability. It does not change the current API or make public the API for sharing source filters\, as this is supposed to be a minimial change because of the code freeze.
On Sun Apr 03 13:20:54 2011\, sprout wrote:
(Slaven\, Iām forwarding this to you\, as these distributions are on your list.)
(Except now I realise that you were the one who opened this ticket to begin with\, so you would have received it anyway.)
Father Chrysostomos via RT wrote:
This is actually more tricky than you suggest\, as Test::More currently supports use_ok("Exporter 5.57") syntax.
That's only a minor complication. Didn't seem worth including it in the sketch of how use_ok should operate.
Do you realise there are twenty distributions affected?
No\, I didn't. That changes the tradeoff calculation a bit. Sounds better to go right to the use_ok that I proposed.
I would suggest that we re-instate the filter-sharing capability (see the attached patch) as a stopgap measure. We could always revert it after 5.14.
Mmhmm. I'd be happier with fixing use_ok\, but I can live with this.
-zefram
On Sun Apr 03 13:26:50 2011\, zefram@fysh.org wrote:
Father Chrysostomos via RT wrote:
This is actually more tricky than you suggest\, as Test::More currently supports use_ok("Exporter 5.57") syntax.
That's only a minor complication. Didn't seem worth including it in the sketch of how use_ok should operate.
Do you realise there are twenty distributions affected?
No\, I didn't. That changes the tradeoff calculation a bit. Sounds better to go right to the use_ok that I proposed.
I would suggest that we re-instate the filter-sharing capability (see the attached patch) as a stopgap measure. We could always revert it after 5.14.
Mmhmm. I'd be happier with fixing use_ok\,
So would I\, if it were easier.
but I can live with this.
OK. Iāve just applied it as 27fcb6e. Iāll see if I can write a Test::More patch\, maybe in the next week or two.
@cpansprout - Status changed from 'open' to 'resolved'
On 2011.4.4 9:22 AM\, Father Chrysostomos via RT wrote:
OK. Iāve just applied it as 27fcb6e. Iāll see if I can write a Test::More patch\, maybe in the next week or two.
This might be a good excuse to assimilate ok.pm. http://search.cpan.org/~audreyt/Test-use-ok-0.02/lib/ok.pm
-- 164. There is no such thing as a were-virgin. -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/
Migrated from rt.perl.org#87064 (status was 'resolved')
Searchable as RT87064$