This Week on perl5-porters - 26 June-2 July 2006

This Week on perl5-porters - 26 June-2 July 2006

"But having it match what perl6 will do is even more important than having it make perfect sense, IMO.", Yitzchak Scott-Thoennes, thinking about forwards compatibility.

Topics of Interest

exit and die in threads

Following on from the threads 1.33 conversation last week that was given short shrift in last week's summary (sorry Jerry), Jerry D. Hedden put forward a proposal to nail down the semantics of what happens when a thread calls exit (and more to the point, what to do about everything that might want to clean up after itself). Throw in a __WARN__ and/or __DIE__ handler or two, and you're starting to talk about some serious fun.

Jan Dubois and Rafael Garcia-Suarez commented on a number of points that Jerry raised, and while Rafael didn't agree with a few things, he was quick to point out that he didn't have any definite opinions one way or another, only that he wanted the best possible solution to come out the discussion.

Dave Mitchell wondered whether it wouldn't be possible to add an exit method to the threads class, which would apply only to the thread, leaving the core exit to behave as usual.

  In through the out door

Jerry the checked with the porters to see whether everyone agreed to what he thought threads should do. Jan and Liz Mattijsen gave their assent.

Just to be really certain, Jerry then posted a consensuality matrix, to get people who had made suggestions to sign off, or explain what they disagreed about. The moral of the story is that calling exit() as a thread method ends the thread, but calling exit() ends everything, modulo some differences in opinion over how much to warn about and when.

  fluid neon origami trick

Jerry went about modifying the threads module to do all this and ran into problems with too many ENTERs and not enough LEAVEs and the like. Jan said that he had no time to look closely, but eyeballed Jerry's code, sketched out a brief idea of what needed to be done. Jerry picked it up and ran with it, and straightened out all the problems.

  Balancing act

By the end of the week, Jerry had the new implementation up and running to his satisfaction, except for a nagging problem of die messages not being captured by the test harness, thus polluting the output.

  Weaving in and out

Dave Mitchell listed the available possibilities:

  New month, new thread

The last remaining eval leaks

After having looked over the stellar achievements of Dave Mitchell in removing eval leaks (caused when the eval'ed code fails), Nicholas Clark listed the remaining known leaks and asked for help in trying to identify the code paths taken (which would help in figuring out how to plug them).

Dr. Ruud suggested taking a look at a tool called MemProf. Dominic Dunlop answered the question with a question, and offered another leak to add to the list.

  Lost property

Did You Know This Worked?

chromatic posted a short, sharp snippet of C, showing how easy it is to insert your own XS code into an existing op code, which opens up all sorts of interesting possibilities.

Is $A::::B::C a bug or feature?

Continuing in the I-didn't-know-Perl-could-do-that vein, Chip Salzenberg discovered that this meant that C is inside package ::B:: which in turn is inside A, and thought it was all rather evil.

Sadahiro Tomoyuki traced the change down to somewhere between 5.004_04 and 5.004_05, when scan_words in toke.c was modified to permit this, some time back in 2003. No-one appeared to remember the reason.

Questions regarding smart match and scalar upgrades in Perl 5

Steve Peters was going over the new smart match (~~) operator from Perl 6, that Robin Houston added to blead last year, and making sure it was well tested. He wrote a couple of tests, was puzzled by the results, and wondered whether the problem lay with the implementation, or with the documentation.

Yitzchak Scott-Thoennes analysed Steve's reasoning, but no firm conclusions were made.

Win32API::File now in core

Steve Hay announced that he had set things up to make Win32API::File a first-class dual-lifed module, in blead and on CPAN. He called on Jan Dubois to see whether Jan needed or wanted to do anything about libwin32. There was discussion of moving files from win32/ext/Win32 to ext/Win32, which would ease the building of perl on Cygwin.

  It just got bigger

Some discussion followed as to whether or not it would make it in time for 5.8.9.

Patches of Interest

vms.c - null termination of string missing.

John E. Malmberg offered a short patch to correct a function that failed to append a null character to strings, which gave the underlying C library indigestion since it was expecting one. Rafael applied.

  Overshooting yourself in the foot

Similarly, Jarkko Hietaniemi taught cflags.SH to scan the gcc warning flags only once:

Adding splint support

Andy Lester set about adding splint (a lint-like tool) support for the porters. First off he created some enhancements:

And then followed with some Makefile splint support. It doesn't quite do everything that it should, and Andy called upon other people (hi Jarkko!) for help.

Dispatches from the consting front

Elsewhere in the code base, Andy tweaked DProf.xs to only compile a small static function if in fact it was actually required in the current configuration.

He then turned his attention to ye cruftey olde mathoms.c. Just because they're obsolete doesn't mean they can't be squeaky clean.

And for dessert, Andy tidied up mg.c, by localising a variable here and there, and encapsulating Perl_* calls in macros.

Removing an inconsistent close $fh

Vadim Konovalov wanted to clean up win32/ by removing an explicit close, since just nearby is a similar open that also omits the close.

Yves Orton that a better idea was to rewrite the code, because it's a complete mess. (Amd it isn't particularly big, either).

  Innovations in brace placement

Watching the smoke signals

Smoke [5.9.4] 28420 FAIL(FMm) OSF1 V5.1 (EV6/4 cpu)]

Jarkko noted some failures had been cropping up in recent smokes, but didn't feel they were specific to the platform (Tru64) he was running.

Nicholas Clark explained what the issues were. One was a simple test design issue that anybody with a reasonable grasp of designing tests should be able to figure out. Alas, no-one had volunteered to have a look. Jarkko asked for more background.

  Background check

The other issue was one of eval leaks, and Jarkko courageously deferred to Dave Mitchell as the likely fixer of that.

  Snot funny

Smoke [5.9.4] 28452 FAIL(F) MSWin32 WinXP/.Net SP2 (x86/2 cpu)

Anno Siegel looked at one of Steve Hay's smokes, and wondered how one was supposed to interpret the results. H. Merijn Brand explained the general case, and Steve explained what was going wrong in this particular case.

  Inconsistent test results (between TEST and harness)

Smoke [5.9.4] 28456 FAIL(c) Solaris 2.10 (i386/1 cpu)

H.Merijn looked at one of Abe Timmerman's failing Solaris smokes and traced it down to a change he'd made to Configure following on from a suggestion from Andy Dougherty. Andy thanked H.Merijn for the catch and noted that the entire hack was no longer needed anyway, since the original problem (one of 64-bit tests) has since been fixed.

New and old bugs from RT

problem on installing DBI module (#39527)

Jan Dubois wrote to say that it is possible to install DBD::Oracle for ActiveState, at the price of also downloading many megabytes of Oracle libraries.

  But alas, only for 5.6

Pattern Match fails for specific length string (#39583)

The code was corrected to handle this problem, and Yves folded the original bug report into the test suite. Yves then went on to rewrite the regexp display code, since, up until now, control characters have always been invisible, which makes it much harder to understand bug reports when control characters are present.

  She's lost control

nl_langinfo ==> Installation problems (#39625)

Jaymax was having problems upgrading 5.8.2 to 5.8.8. miniperl was dying with a Undefined symbol "nl_langinfo" error. No takers as yet.

Using nonsensical key in %SIG should generate a warning (#39630)

Nik thought that he would have saved a lot of time if perl complained about trying to use keys in %SIG that don't refer to valid signal handlers. Rafael thought that the problem might be because that the code in question was not, in fact, running with warnings enabled.

  Ask no questions, tell no lies

@ISA is not mentioned in perlvar (#39633)

Sebastian Schmidt kicked off a long thread about whether or not @ISA should be referenced in perlvar or not. The main dissent was due to the fact that @ISA isn't particularly special as far as perl is concerned, it merely has lots of cultural conventions associated with it.

Nevertheless, it was agreed that perlvar should in fact list all extraordinary variables, with L<> references to the appropriate pages if a better definition already existed elsewhere.

gcc 3.3 has problems with __attribute__((unused)) (#39634)

John Gardiner Myers was having some trouble compiling Encode::Detect with the GNU C++ compiler. Andy Dougherty realised that blead had already solved this problem and proposed a couple of patches to get things going. John, however, had another patch that he thought was better. After looking at it, Andy did too. He tidied it up slightly, and suggested that it was fit for inclusion to both blead and maint.

Configure (on Solaris 64-bit) fails (#39636)

Marc Esser was having trouble configuring perl on Solaris 10. After a getting Marc to try a few things, Andy Dougherty believed that he had isolated the problem in some incorrect hints for Solaris.

filetest problem with STDIN/STDOUT on Windows (#39637)

Paul Marquess reported that he had had some problems with not being able to apply -r to \*STDIN and get a sensible result back on Windows.

  Par for the course

perldoc -f waitpid has wrong code example (#39639)

Alexander Gernler mentioned that he thought the snippet explaining waitpid was wrong, and that it should use a do/while loop and not a do/until loop. Rafael agreed, and Salvador Fandiño and Dr. Ruud made a few suggestion about making the snippet truly cross platform (well, and least Unix and Windows).

  Zombie-free zone

XSUB.h in perl v5.8.8 with gcc 3.4.6 (#39644)

Jon V. had a weird compilation error. Rafael suspected that some errant header was defining a symbol standing in for a function or something, as a number.

DynaLoader corrupts %ENV (#39647)

Daniel Pfeiffer as having trouble with a Solaris 2.10 box coming to grief with environment variables eating all available memory. Rafael had trouble reproducing it. So did Daniel for that matter. Unfortunately, there's not much to go on.

require and List::MoreUtils seg fault (#39650)

Darin McBride had some code worked if List::MoreUtils was used, but dumped core if it was required. Rafael saw that the problem lay in the module building an iterator as a closure to traverse an array, but couldn't see off-hand why it should fail.

perl crashes with simple regex (#39652)

Another back-tracking stack-blowing pattern.


Regex performance with UTF-8 strings (#39654)

Peter J.Holzer discovered that taking a simple byte string and upgrading it to UTF-8 makes the match go three times slower when the target remains byte-encoded. Or, to put it another way, if the polarity of the target and regexp are reversed, performance is awful.

Even Yves admitted to being scared at the amount of effort required to make the engine do the right thing. It's doable, and he's thought about it on occasion. Sadahiro Tomoyuki gave Peter a tip that helped in improve the performance in his particular case.

  Fruit at the top of the tree

Yves went onto to explain far more than you ever wanted to know about UTF-8, and just how much effort it takes to move to the next character in a string. Juerd suggested a number of optimisations that, if implemented, may improve performance. Yves went down the list and pointed out that nearly all of Juerd's ideas are already implemented in the engine in some way or another.

In other sub-thread, Sadahiro caught a naughty macro that lacked a parenthesised argument, which Rafael fixed in blead.

  It ain't easy

Perl5 Bug Summary

  + 13 - 7 = 1499

  Ooh, nice RT upgrade

New Core Modules

In Brief

Rafael announced that he was removing references to 5005threads in the perlguts documentation.

  The end of the line

Steve Hay showed the best settings to get the most out of malloc on the Win32 platform.

Andy Lester noted that the Coverity defect scan of the codebase had risen from 35 to 40 in two weeks.

  Misfeature creep

Alan Burlison pointed to Data Race Detection Tool (or DRDT) from Sun, which is a tool designed to help track down data race issues with threads.

  Might be handy

Sébastien Aperghis-Tramoni posted a small precision about \Q \E inside m//x, after having spent too much time trying to figure out why his code wasn't doing what he expected.


Brendan O'Dea put forward a modest proposal remove x2p/*, that is, the awk-to-perl and sed-to-perl scripts, arguing that no-one uses them anymore. Neither Rafael nor H.Merijn were in favour of such a move.

Craig A. Berry tidied up some POD typos.

About this summary

This summary was written by David Landgren.

Last week's unfinished opus attracted a comment from Nicholas Clark asking how other open-source languages deal with the day to day housekeeping, and he even received an answer!

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.