On Tue, Dec 30, 2003 at 01:26:59AM -0000, rob@exitexchange.com (via RT) wrote: > created a format with eval, that does NOT include a trailing \n, > gives the following error when write() is called: > > Assertion fpc <= fops + maxops failed: file "pp_ctl.c", line 3731 at (eval 1) line 5. Ah, mea cupla! Fixed by patch #22005 (Nick, this is a good candidate for 5.8.3) -- But Pity stayed his hand. "It's a pity I've run out of bullets", he thought. - "Bored of the Rings" Change 22005 by davem@davem-percy on 2003/12/30 15:07:50 Subject: Re: [perl #24774] eval + format - \n = pp_ctl.c assertion heuristics for calculating buffer size needed to compile a format didn't allow for \0 Affected files ... ... //depot/perl/pp_ctl.c#377 edit ... //depot/perl/t/op/write.t#31 edit Differences ... ==== //depot/perl/pp_ctl.c#377 (text) ==== @@ -3580,7 +3580,7 @@ /* estimate the buffer size needed */ for (base = s; s <= send; s++) { - if (*s == '\n' || *s == '@' || *s == '^') + if (*s == '\n' || *s == '\0' || *s == '@' || *s == '^') maxops += 10; } s = base; ==== //depot/perl/t/op/write.t#31 (xtext) ==== @@ -5,7 +5,7 @@ @INC = '../lib'; } -print "1..49\n"; +print "1..50\n"; my $CAT = ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') ? 'type' : ($^O eq 'MacOS') ? 'catenate' @@ -300,14 +300,24 @@ print `$CAT Op_write.tmp`; } +{ + # Bug #24774 format without trailing \n failed assertion + 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"; +} + ####################################### # Easiest to add new tests above here # ####################################### -# 14..49: scary format testing from Merijn H. Brand +# 15..50: scary format testing from Merijn H. Brand -my $test = 14; -my $tests = 49; +my $test = 15; +my $tests = 50; if ($^O eq 'VMS' || $^O eq 'MSWin32' || $^O eq 'dos' || $^O eq 'MacOS' || ($^O eq 'os2' and not eval '$OS2::can_fork')) {