This Week on perl5-porters - 12-18 June 2006

This Week on perl5-porters - 12-18 June 2006

"I'm still a big fan of partial solutions. But to get a good partial solution, you can't just rush into it without thinking about what the tradeoffs really are." -- Mark-Jason Dominus, on reversible debugging

Topics of Interest

Regular expressions: bugs, tests and benchmarks

As the changes Yves Orton made to the regular expression engine get worked over by the smoke testers and other more adventurous souls, a couple of problems have come to light.

Nicholas Clark found that the following snippet caused a segfault during global destruction.

  $a = qr/(xx|yy)/;
  sub a {'xx' =~ $a and print 'ok'};

Yves fixed that up with a one-line change (a reference counting adjustment).

  Ha ha ha plonk

Dave Mitchell caught another one, simply by running a build and watching ext/re/t/ lose it, which Rafael Garcia-Suarez corrected with a guard to re_debug_flags, but wondered why it was being set to NULL in the first place. Answer: it happens during global destruction.

  Changing of the guards

Jarkko Hietaniemi found some other problems with the trie code on Tru64 in conjunction with -DDEBUGGING. After a quick examination, Yves couldn't find a good explanation why, but suggested a couple of nice places for setting breakpoints.

After running down a few dead ends, Jarkko finally narrowed the problem down to taking the address of something on the stack. Hoisting the declaration outwards fixed the problem.

  A class of his own

Yves made an appeal for more tests that exercise Unicode pattern matching. Not the funky, contrived examples that the porters come up with to exercise obscure parts of the code base, but real honest-to-goodness matches that happen in Real Life.

  If you test it, they will come

Tels came back with some late comments on the trie enhancements. Yves had an answer to all of the questions, going so far as to suggest that a nice optimisation would be to convert patterns consisting of a single EXACT node to an index() call, thereby avoiding regmatch() altogether.


Yves caught a bug before anyone could step on it.

  The unguarded moment

Dave Mitchell also did some more follow-up work on his efforts to remove recursion from the regular expression engine.

  Switched on state

Could Perl get Reversible Debugging?

Adam Kennedy had recently encountered two discussions of reversible debugging, and wondered how plausible this could be for Perl. (Reversible debugging is the idea of being able to undo the previous "r"un or "n"ext statement, and recover the previous state. (History trivia: Roedy Green wrote a language called Abundance in the 70s that provided support for this mechanism. He called it jaunting)).

Randy W. Sims thought that a system that merely recorded the current system state by snapshot would be good enough. You could not go back in time and change things, but you could at least look at them again. Useful if you missed something.

Some things cannot be reversed anyway: system calls, network writes, different paths might cause cleanup handlers to never be called.

Jesse pointed to Leon Brocard's Devel::ebug, which offers an undo mechanism. Mark-Jason Dominus mapped out the different points on the continuum, showing what was easy, simple and fairly useless all the way to difficult, hard and very useful, but we should be able to get something good at a reasonable cost. His suggestion was to teach the debugger to record all the commands during a session, and then allow one to restart the session, replaying all the commands up to some point in the stream.

Richard Foley explained that this latter trick was already available in the current debugger. It's called rerun.

David Nicol suggested forking a new copy of the program at each perl statement, and communicate between the prior state processes to determine the difference in state. This would of course entail immense resource costs. Alternately, a fork and dump on each statement would merely chew disk space, instead of RAM. But at the end of the thread, Adam came back and explained that he didn't really care to go back and re-execute the program from a given point. He just wanted to be able to go back and look at what had happened as a disinterested observer (a bit like TV).

  We need a "come from" instruction

New, improved perlbrowse

Dave Mitchell announced a new release of the perlbrowse tool, that allows the porters to look at the source code from the point of view of the repository, and view the changes made to the code base over time.

  Whiter than #ffffff

Big Perl 5 advocacy thread

One of the biggest threads to hit p5p in months, which goes to show that there's still interest in the beast.

Yves Orton kicked off the thread, writing about the problem of Perl 5 and Perl 6 and it sounded like a replay of the Osborne Effect (Adam Osborne built a phenomenally successful portable computer in the 1980s, and preannounced the arrival of a new faster model. People stopped buying the current model, waiting for the new one to be released. The competition ate the company).

Some of the main points:

  Yeah, but we knew all that

Patches of Interest


Lots of internals talk here, and not enough time to summarise the ramifications.

  It's that U magic

Proper use of enums

Thanks to Intel's optinagging compiler, Andy Lester straightened out the mess of enums being mixed with non-enums, especially in relation to svtypes.

Static cleanup in pp_sort.c

Andy then tidied up S_qsortsvu() and made embed.fnc refer to it (for error checking) and used the macro'ed version where applicable.

universal.c does it

Rafael added the DOES method to UNIVERSAL following on from chromatic's desire several weeks ago to try and make UNIVERSAL more useful, or rather, less abused. He then hinted that chromatic was probably in the best place to write the appropriate documentation.

Andy slotted it into the right place in embed.fnc.

And chromatic delivered the documentation goods.

Watching the smoke signals

Smoke [5.9.4] 28397 FAIL(F) hp-ux 11.23/64 (ia64/2 cpu)

Dave Mitchell observed that this failure "was caused by the interesting fact that a detached thread still counts towards the A thread exited while %d threads were running warning, in violation of the docs". And so he fixed it.

New and old bugs from RT

Wishlist about Sys::Syslog (#35406)

Keisuke Hirata filed a bug report about Sys::Syslog and bundled the patch used to fix the problem. Sbastien Aperghis-Tramoni announced that it had been included in version 0.16, now available from your neighbourhood CPAN mirror.

  A dream comes true

Cygperl allows reading of write-only file descriptors (#39325)

Both David Landgren and Dr. Ruud tried to make sense of this bug. Sébastien A-T thought that it may be a manifestation of another Cygwin-ism that had caused him grief in the past.

  Too Unix to be Windows, too Windows to be Unix?

Data::Dumper fails to escape bless class name (#39420)

Any users out there still using ' (apostrophe) in their class names? Well don't, because Data::Dumper has forgotten about it.

Carp can't find Carp::Heavy (#39440)

Funny how things come in waves. This was another manifestation of last week's bug about what happens to Carp when perl runs out of file handles.


file level my variables are invisible inside anonymous subs (#39489)

By another strange coincidence, this bug has also been fixed in the next release.

  Waiting for 5.10

Core dump on process exit with tie %SIG (#39504)

John Gardiner Myers discovered a way to make perl dump core, and suspected that the act of tieing %SIG may have something to do with it.

  Where porters fear to tread

And another data point:

  Curiouser and curiouser

Perl5 Bug Summary

  3 closed and 6 open: 1491 total

  They're all here

New Core Modules

In Brief

A new website, opened its doors this week.

  Contribute! Contribute!

Ravi Sastry Kadali, from the IBM zOS USS Development team reported having ported 5.8.7 onto IBM z/OS. The team had to make some changes to the source, and wanted to contribute them back to the porters.

Rafael explained that ideally, they should try and port blead, and send the required changes back for integration. These changes can then be ported over to the maintenance branch if not compatibility problems are encountered.

Steve Stiert then sent in the patch anyway. Jarkko Hietaniemi had a look at it.

Daniel Frederick Crisman had yet another shot at reworking quote-like operators in perlop.

  When in doubt, use brute force

Yves sent in a patch to fix some segmentation faults during global destruction (in relation to his regexp work) and also tweaked Benchmark to stop it from hitting infinite loops.

  Two for the price of one

Tom Schindl was bitten by the map in void context memory wastage problem, that neither foreach, nor more recent versions of Perl, for that matter.

Jarkko reworked the gcc warnings selection mechanism, to allow the porters, and more specifically Andy Lester, to enable all sorts of wacky compiler switches to see what happens.


Philip M. Gollucci attempted to perform a speed comparison from 5.6.2 to blead, but the results were flawed because he used perl binaries compiled with debugging. He promised to redo them again, without debugging.

Shlomi Fish wrote in to say that he had found a bug with perl -d not printing the current code line.

  So perlbug it

John E. Malberg found a show stopper in blead concerning Unicode. Sadahiro Tomoyuki proposed a fix, and Craig A. Berry committed the change.

Yitzchak Scott-Thoennes recalled that in the core there are actual arrays of arrays (and not arrays of references to arrays), but could not recall where.

Salvador Fandiño took another stab at adding macros to Perl5.

Andreas J. Koenig discovered that the APC archive is missing files 28373-28377.

  We have backups, right?

About this summary

This summary was written by David Landgren. Last week's summary...

... attracted a reply from Yves, who followed up on the issue of pluggable regexp engines for maint. The problem is one of a bad design call, made in the distant past, for which Nicholas Clark is pondering a "deeply evil" workaround.

Tels also replied, with a plug for his Math::String module, that lets one perform automagical increments (and decrements) on just about anything that looks incrementable. And if it doesn't work with Unicode, file a bug report so that Tels can fix it.

If you want a bookmarklet approach to viewing bugs and change reports, there are a couple of bookmarklets that you might find useful on my page of Perl stuff:

Weekly summaries are published on and posted on a mailing list, (subscription: The archive is at Corrections and comments are welcome.

If you found this summary useful, please consider contributing to the Perl Foundation to help support the development of Perl.