New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semi-Semicolons test suite is broken since perl 5.13.7 #11212
Comments
From @eserteThis is a bug report for perl from slaven@rezic.de, The problem is described in The author (MSCHWERN) suggests that the breakage could be caused Regards, Flags: 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: Locally applied patches: @INC for perl 5.13.11: Environment for perl 5.13.11: |
From @cpansproutOn Sat Mar 26 05:33:43 2011, slaven@rezic.de wrote:
This was caused by the following commit: commit f07ec6d remove filter inheritance option from lex_start 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 BEGIN{ eval "use Semi::Semicolons" } This now fails to activate the source filter because the eval and the To resolve this, either we can just revert that patch (which would be an |
The RT System itself - Status changed from 'new' to 'open' |
From zefram@fysh.orgFather Chrysostomos via RT wrote:
Eww. Let's not restore that behaviour. Change whatever was relying on it. -zefram |
From @rgarciaOn 28 March 2011 12:39, Zefram <zefram@fysh.org> wrote:
I would second that; anything that makes source filters a bit less |
From zefram@fysh.orgFather Chrysostomos via RT wrote:
It occurred to me that not only does this now run into trouble with source $ perl -le 'use Test::More tests => 2; BEGIN { use_ok("strict", "vars"); } $z; ok 1;' 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;' So I reckon use_ok is seriously broken, and the core change has just sub my_use($;@) { -zefram |
From @iabynOn Tue, Mar 29, 2011 at 12:16:33PM +0100, Zefram wrote:
But of course, if does the goto (to get the correct caller lexical scope), So I suspect that use_ok() is fundamentally unsuitable (and not fixable) In which case, it's probably best to just document this limitation in If this is acceptable, then this ticket ceases to be a 5.14 blocker. -- |
From zefram@fysh.orgDave Mitchell wrote:
True, but it's not a disaster if we change use_ok() to work this way.
I think what I outlined above is a better tradeoff than leaving use_ok()
I think this is the best approach for 5.14. -zefram |
From @cpansproutOn Wed Mar 30 07:32:21 2011, zefram@fysh.org wrote:
This is actually more tricky than you suggest, as Test::More currently
Do you realise there are twenty distributions affected? Acme::Base64 I would suggest that we re-instate the filter-sharing capability (see (Slaven, I’m forwarding this to you, as these distributions are on your |
From @cpansproutFrom 2f1624fb1b763c9899594d1671941477b7df2091 Mon Sep 17 00:00:00 2001 [perl #87064] eval no longer shares filters Before this commit: commit f07ec6d remove filter inheritance option from lex_start The only uses of lex_start that had the new_filter parameter false, string evals could inherit the same source filter space as the cur- There are at least 20 CPAN distributions relying on this behaviour. Inline Patchdiff --git a/MANIFEST b/MANIFEST
index 1e2189e..0fea93d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3633,6 +3633,7 @@ ext/XS-APItest/t/cleanup.t test stack behaviour on unwinding
ext/XS-APItest/t/cophh.t test COPHH API
ext/XS-APItest/t/copyhints.t test hv_copy_hints_hv() API
ext/XS-APItest/t/customop.t XS::APItest: tests for custom ops
+ext/XS-APItest/t/eval-filter.t Simple source filter/eval test
ext/XS-APItest/t/exception.t XS::APItest extension
ext/XS-APItest/t/grok.t XS::APItest: tests for grok* functions
ext/XS-APItest/t/hash.t XS::APItest: tests for hash related APIs
diff --git a/ext/XS-APItest/APItest.pm b/ext/XS-APItest/APItest.pm
index b95af26..5ef9ea2 100644
--- a/ext/XS-APItest/APItest.pm
+++ b/ext/XS-APItest/APItest.pm
@@ -50,7 +50,7 @@ sub import {
}
}
-our $VERSION = '0.27';
+our $VERSION = '0.28';
use vars '$WARNINGS_ON_BOOTSTRAP';
use vars map "\$${_}_called_PP", qw(BEGIN UNITCHECK CHECK INIT END);
@@ -209,6 +209,11 @@ correctly by C<printf>.
Output is sent to STDOUT.
+=item B<filter>
+
+Installs a source filter that substitutes "e" for "o" (witheut regard fer
+what it might be medifying).
+
=item B<call_sv>, B<call_pv>, B<call_method>
These exercise the C calls of the same names. Everything after the flags
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 0ce4d51..4fa4e1e 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -996,6 +996,26 @@ peep_xop(pTHX_ OP *o, OP *oldop)
av_push(MY_CXT.xop_record, newSVpvf("oldop:%"UVxf, PTR2UV(oldop)));
}
+static I32
+filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
+{
+ SV *my_sv = FILTER_DATA(idx);
+ char *p;
+ char *end;
+ int n = FILTER_READ(idx + 1, buf_sv, maxlen);
+
+ if (n<=0) return n;
+
+ p = SvPV_force_nolen(buf_sv);
+ end = p + SvCUR(buf_sv);
+ while (p < end) {
+ if (*p == 'o') *p = 'e';
+ p++;
+ }
+ return SvCUR(buf_sv);
+}
+
+
XS(XS_XS__APItest__XSUB_XS_VERSION_undef);
XS(XS_XS__APItest__XSUB_XS_VERSION_empty);
XS(XS_XS__APItest__XSUB_XS_APIVERSION_invalid);
@@ -2750,6 +2770,11 @@ CODE:
PERL_UNUSED_VAR(items);
croak("postinc called as a function");
+void
+filter()
+CODE:
+ filter_add(filter_call, NULL);
+
BOOT:
{
CV *asscv = get_cv("XS::APItest::postinc", 0);
diff --git a/ext/XS-APItest/t/eval-filter.t b/ext/XS-APItest/t/eval-filter.t
new file mode 100644
index 0000000..8d370e5
--- /dev/null
+++ b/ext/XS-APItest/t/eval-filter.t
@@ -0,0 +1,10 @@
+#!perl -w
+use strict;
+
+use Test::More tests => 1;
+use XS::APItest;
+
+BEGIN { eval "BEGIN{ filter() }" }
+
+is "foo", "fee", "evals share filters with the currently compiling scope";
+# See [perl #87064].
diff --git a/op.c b/op.c
index 2e15a8d..e917d43 100644
--- a/op.c
+++ b/op.c
@@ -4453,7 +4453,7 @@ Perl_vload_module(pTHX_ U32 flags, SV *name, SV *ver, va_list *args)
ENTER;
SAVEVPTR(PL_curcop);
- lex_start(NULL, NULL, 0);
+ lex_start(NULL, NULL, LEX_START_SAME_FILTER);
utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0),
veop, modname, imop);
LEAVE;
diff --git a/parser.h b/parser.h
index e4a06dc..17ced8f 100644
--- a/parser.h
+++ b/parser.h
@@ -112,6 +112,9 @@ typedef struct yy_parser {
/* flags for lexer API */
#define LEX_STUFF_UTF8 0x00000001
#define LEX_KEEP_PREVIOUS 0x00000002
+#ifdef PERL_CORE
+# define LEX_START_SAME_FILTER 0x00000001
+#endif
/* flags for parser API */
#define PARSE_OPTIONAL 0x00000001
diff --git a/pp_ctl.c b/pp_ctl.c
index 44cf3c1..aabbcd3 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3090,7 +3090,7 @@ Perl_sv_compile_2op_is_broken(pTHX_ SV *sv, OP **startop, const char *code,
PERL_ARGS_ASSERT_SV_COMPILE_2OP_IS_BROKEN;
ENTER_with_name("eval");
- lex_start(sv, NULL, 0);
+ lex_start(sv, NULL, LEX_START_SAME_FILTER);
SAVETMPS;
/* switch to eval mode */
@@ -3957,7 +3957,7 @@ PP(pp_entereval)
TAINT_PROPER("eval");
ENTER_with_name("eval");
- lex_start(sv, NULL, 0);
+ lex_start(sv, NULL, LEX_START_SAME_FILTER);
SAVETMPS;
/* switch to eval mode */
diff --git a/toke.c b/toke.c
index 9642ad3..f5f1f8a 100644
--- a/toke.c
+++ b/toke.c
@@ -667,11 +667,15 @@ code in I<line> comes first and must consist of complete lines of input,
and I<rsfp> supplies the remainder of the source.
The I<flags> parameter is reserved for future use, and must always
-be zero.
+be zero, except for one flag that is currently reserved for perl's internal
+use.
=cut
*/
+/* LEX_START_SAME_FILTER indicates that this is not a new file, so it
+ can share filters with the current parser. */
+
void
Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags)
{
@@ -679,7 +683,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags)
const char *s = NULL;
STRLEN len;
yy_parser *parser, *oparser;
- if (flags)
+ if (flags && flags != LEX_START_SAME_FILTER)
Perl_croak(aTHX_ "Lexing code internal error (%s)", "lex_start");
/* create and initialise a parser */
@@ -708,7 +712,10 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags)
parser->lex_state = LEX_NORMAL;
parser->expect = XSTATE;
parser->rsfp = rsfp;
- parser->rsfp_filters = newAV();
+ parser->rsfp_filters =
+ !(flags & LEX_START_SAME_FILTER) || !oparser
+ ? newAV()
+ : MUTABLE_AV(SvREFCNT_inc(oparser->rsfp_filters));
Newx(parser->lex_brackstack, 120, char);
Newx(parser->lex_casestack, 12, char); |
From @cpansproutOn Sun Apr 03 13:20:54 2011, sprout wrote:
(Except now I realise that you were the one who opened this ticket to |
From zefram@fysh.orgFather Chrysostomos via RT wrote:
That's only a minor complication. Didn't seem worth including it in
No, I didn't. That changes the tradeoff calculation a bit. Sounds better
Mmhmm. I'd be happier with fixing use_ok, but I can live with this. -zefram |
From @cpansproutOn Sun Apr 03 13:26:50 2011, zefram@fysh.org wrote:
So would I, if it were easier.
OK. I’ve just applied it as 27fcb6e. I’ll see if I can write a |
@cpansprout - Status changed from 'open' to 'resolved' |
From @schwernOn 2011.4.4 9:22 AM, Father Chrysostomos via RT wrote:
This might be a good excuse to assimilate ok.pm. -- |
Migrated from rt.perl.org#87064 (status was 'resolved')
Searchable as RT87064$
The text was updated successfully, but these errors were encountered: