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
eval + format - \n = pp_ctl.c assertion #7009
Comments
From rob@exitexchange.comThis is a bug report for perl from rob@exitexchange.com, created a format with eval, that does NOT include a trailing \n, Assertion fpc <= fops + maxops failed: file "pp_ctl.c", line 3731 at (eval 1) line 5. Test case: my @v = ('k'); # eval "format STDOUT = \n@\n\@v\n"; # does NOT trigger bug write; Flags: Site configuration information for perl v5.8.2: Configured by rob at Mon Nov 17 11:00:52 PST 2003. Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Locally applied patches: @INC for perl v5.8.2: Environment for perl v5.8.2: Complete configuration data for perl v5.8.2: Author='' |
From @iabynOn Tue, Dec 30, 2003 at 01:26:59AM -0000, rob@exitexchange.com (via RT) wrote:
Ah, mea cupla! Fixed by patch #22005 -- Change 22005 by davem@davem-percy on 2003/12/30 15:07:50 Subject: Re: [perl #24774] eval + format - \n = pp_ctl.c assertion Affected files ... ... //depot/perl/pp_ctl.c#377 edit Differences ... ==== //depot/perl/pp_ctl.c#377 (text) ==== @@ -3580,7 +3580,7 @@ /* estimate the buffer size needed */ ==== //depot/perl/t/op/write.t#31 (xtext) ==== @@ -5,7 +5,7 @@ -print "1..49\n"; my +{ -# 14..49: scary format testing from Merijn H. Brand -my $test = 14; if ( |
@iabyn - Status changed from 'open' to 'resolved' |
From wolfgang.laun@alcatel.atOn Tue, 30 Dec 2003 15:30:37 +0000 davem@fdisolutions.com wrote:
Festina lente ;-) Yes, it fixes the assertion failure and all that may come from an bash$ cat fmtbug.pl The lone semicolon is sneaked into the string to be eval'ed, and no check A patch against toke.c (5.8.2) appears to fix this: bash$ ./perl fmtbug.pl This breaks the new test 14 in t/op/write.t, so this is patched again. Finally I'd like to draw your attention to the fact that some NULL Regards Inline Patch--- toke.c.old Fri Jan 2 08:50:37 2004
+++ toke.c Fri Jan 2 10:11:31 2004
@@ -2424,8 +2424,12 @@
if (!PL_rsfp) {
PL_last_uni = 0;
PL_last_lop = 0;
- if (PL_lex_brackets)
- yyerror("Missing right curly or square bracket");
+ if (PL_lex_brackets) {
+ if (PL_lex_formbrack)
+ yyerror("Format not terminated");
+ else
+ yyerror("Missing right curly or square bracket");
+ }
DEBUG_T( { PerlIO_printf(Perl_debug_log,
"### Tokener got EOF\n");
} );
@@ -7577,6 +7581,7 @@
register char *t;
SV *stuff = newSVpvn("",0);
bool needargs = FALSE;
+ bool eofmt = FALSE;
while (!needargs) {
if (*s == '.' || *s == /*{*/'}') {
@@ -7586,8 +7591,10 @@
#else
for (t = s+1;SPACE_OR_TAB(*t) || *t == '\r'; t++) ;
#endif
- if (*t == '\n' || t == PL_bufend)
+ if (*t == '\n' || t == PL_bufend) {
+ eofmt = TRUE;
break;
+ }
}
if (PL_in_eval && !PL_rsfp) {
eol = strchr(s,'\n');
@@ -7627,7 +7634,6 @@
PL_last_lop = PL_last_uni = Nullch;
if (!s) {
s = PL_bufptr;
- yyerror("Format not terminated");
break;
}
}
@@ -7656,7 +7662,8 @@
}
else {
SvREFCNT_dec(stuff);
- PL_lex_formbrack = 0;
+ if (eofmt)
+ PL_lex_formbrack = 0;
PL_bufptr = s;
}
return s;
--- t/op/write.t.old Fri Jan 2 11:11:28 2004
+++ t/op/write.t Fri Jan 2 10:53:50 2004
@@ -302,12 +302,10 @@
{
# Bug #24774 format without trailing \n failed assertion
+ # but this must not compile because we'd get a ';' into the format
my @v = ('k');
eval "format OUT14 = \n@\n\@v";
- open(OUT14, '>Op_write.tmp') || die "Can't create Op_write.tmp";
- write(OUT14);
- close OUT14 or die "Could not close: $!";
- print "ok 14\n";
+ print $@ ? "ok 14\n" : "not ok 14\n";
}
####################################### |
From @TuxOn Fri 02 Jan 2004 11:31, LAUN Wolfgang <wolfgang.laun@alcatel.at> wrote:
Wolfgang, can I please have your comments on this: On Mon 27 Oct 2003 19:36, "H.Merijn Brand" <h.m.brand@hccnet.nl> wrote:
-- |
From wolfgang.laun@alcatel.atHi Merijn, just a quick answer:
Well, even then you'd want to keep escapes.
These things happen in pp_ctl.c, and not just to ESC either. It seems THIS PATCH IS UNTESTED! I'll be back.
Inline Patch--- pp_ctl.c.new Fri Jan 2 12:45:32 2004
+++ pp_ctl.c Fri Jan 2 12:50:13 2004
@@ -621,23 +621,15 @@
*t = '\0';
sv_catpvn_utf8_upgrade(PL_formtarget, s, arg, nsv);
for (; t < SvEND(PL_formtarget); t++) {
-#ifdef EBCDIC
- int ch = *t++ = *s++;
- if (iscntrl(ch))
-#else
- if (!(*t & ~31))
-#endif
+ int ch = *t = *s++;
+ if (isSPACE(ch))
*t = ' ';
}
break;
}
while (arg--) {
-#ifdef EBCDIC
int ch = *t++ = *s++;
- if (iscntrl(ch))
-#else
- if ( !((*t++ = *s++) & ~31) )
-#endif
+ if (isSPACE(ch))
t[-1] = ' ';
}
break; |
From @iabynOn Fri, Jan 02, 2004 at 11:31:46AM +0100, LAUN Wolfgang wrote:
Nil illegitimo carborundum?
Thanks, applied as 22055.
My personal take on this (not that I ever use formats!) is that since Dave. -- |
Migrated from rt.perl.org#24774 (status was 'resolved')
Searchable as RT24774$
The text was updated successfully, but these errors were encountered: