This Week on perl5-porters - 11-17 September 2006

This Week on perl5-porters - 11-17 September 2006

"Now to move a huge pile of bugs out of my queue and into Randy's. THUD" -- Michael G. Schwern, making MakeMaker lighter.

Topics of Interest

Adding macros to Perl5

Jim Cromie followed up an old message from Salvador Fandiño about better assertion support in perl. He went through the repository and dug out all the patches, but when he applied them to blead it wouldn't compile.

threads causing smoke trouble on Win32 again

Steve Hay reported intermittent hangs when smoking threads on Win32. He gathered a bit more information by running the tests manually, but wasn't able to get things to fail reliably. Dave Mitchell muttered something about race conditions in thread finishing, but wasn't able to recall precisely what it was that he had noticed.

Jerry D. Hedden checked in a patch elsewhere to clear this up this week.

  The race is on

Safe signals and SIGSEGV

Rafael Garcia-Suarez wondered whether SIGSEGV should be delivered by default in unsafe mode, and pointed to a bug report in Mandriva Linux that exposed the problem. Dave Mitchell tended to agree, and suggested that SIGBUS and SIGILL be thrown in as well.

Mike Guy was in full agreement, and made a list of six points that needed to be taken into consideration.

  "This is your Captain. We are about to attempt a crash landing"

Problems with (??{...}) in blead

Yves Orton was taking the latest engine for a spin and noticed that Regexp::Common revealed a problem with how (??{...}) and backtracking no longer play nicely together.

Dave Mitchell admitted that he must have backed over something in re_eval and promised to straighten it out when he had a few moments. Yves proposed one way of fixing it, after having taken a look at (and understood) how it currently works. Dave begged Yves not to go down that road, since it would rely on infrastructure that Dave is currently in the process of ripping out and replacing.

  I hear shiny

Acme::Meta is broken again

Andreas König noticed that change #26867 in blead resulted in Acme::Meta becoming unbuildable. Nicholas Clark noted that this was the second time that it had been broken, and wondered if the most expedient solution was simply to add Acme::Meta to the core.

Seriously though, the question to be asked was is what it does considered appropriate behaviour, and thus deserving of proper support? In which case regression tests need to be added to the test suite (Acme::Meta plays fast and loose with stashes -- symbol table hashes). Rafael proposed a patch to Acme::Meta which restores full functionality (?) whilst keeping the the recent speed optimisations that have been made in the neighbourhood.

  Acme Development Company

Help me-e-e-e-e

After a certain Chandra Sekaran posted a vague bug report that mentioned PERL, LDAP and the MS Event Viewer, Dominic Dunlop provided a detailed response on what steps Chandra should take to get the problem fixed, which prompted Andy Dougherty to thank Dominic for his kindness and patience over the years when dealing with such reports.

  And he didn't even mention uppercase

Similarly, Dominic patiently walked a guy named Richard through trying to identify why perl was crashing in a SpamAssassin/Mac OS/X environment.

More on trimming OPs

Dave Mitchell took a look at Jim Cromie's work on combining op_next and op_sibling in the opcode structure, and wanted to obtain better figures on what the memory difference would be. Dave thought that the massive creation of SVs that come about when one does any sort of work would drown out the savings made in shrinking the opcodes.

As Jim had been encountering difficulties in getting the patch to work correctly, he had been asking for help (which then in turn would allow such benchmarks to be obtained). Dave Mitchell suggested an elegant trick that at least defers having to get it to work.

Just add an extra dummy field to the structure and see how much the overall programs grows. One could then conclude that if Jim were to succeed in his efforts, the program would shrink by an equivalent amount in the other direction.

Depending on the code, the change is negligible or significant. More real-world code samples will be needed to see whether it is worth pursuing. Joshua ben Jore reminded him that B::Deparse, Data::Dumper must not be broken because of such changes.

  Union structure blues

David Nicol set about trying to prod the compiler into producing large amounts of code to shed light on Jim's improvements.

Core support for Data::Bind

Chia-liang Kao explained what new core support would be required to make Data::Bind (which provides Perl6-style semantics for subroutine arguments) a little less of a kluge. The main problem is to have a read-only lexical alias that points to a regular read-write lexical.

The easy way out would be to hang the information off the target SV, but then the original SV naturally becomes read-only as well, which is exactly what we're trying to avoid. Thus some sort of shim layer is needed between the alias and the original to get a chance to to the deed, which caused chromatic to mutter something out bestowing a new vtable upon an SV.

Rick Delaney and Rafael Garcia-Suarez debated syntax. Nicholas Clark and Larry Wall debated implementation issues (with an eye to backwards compatibility: any number of suitable solutions exists, but they would break existing XS code. Not good).

  ... and in the data bind them

Taint and memory usage

Xho Jingleheimerschmidt wondered why running a program with taint checks appears to double the amount of memory required. This can be a problem on lean machines. Xho wanted to know if there is a work-around for it, or failing that, an explanation of why it occurs.

I figured out one part of the problem and will have posted a partial reply next week, but you'll have to wait until then and see whether an internals guru picks up the ball and runs with it.

  Getting ahead of myself

Dual-lifing Devel::DProf

Andy Lester, evidently having too much spare time on his hands, thought it would be a good idea if he were to take care of Devel::DProf. Except that it's noted on CPAN that Ilya Zakharevich is already the author. Then again, the version bundled with blead is different, anyway.

Ilya was rather non-committal on the idea, citing that while a more portable codebase is desirable, the module is too intimately tied to perl's internals for it to be easy to make a one-size-fits-all distribution. Rafael thought that it might lead to a twisty maze of #ifdefs.

Be that as it may, Andy was most interested in making improvements to the dprofpp end of things. (Which makes me wonder whether the distribution needs to be some dimorphic beast: one side that gathers profiling information, and the other side that does the reporting).

  More like dual-heading it

Patches of Interest

Race condition fixes for threads

Jerry D. Hedden posted a patch to fix what he thought was the cause of the race conditions that have been seen (above) with threads. Dave Mitchell appreciated the effort, but rebuked Jerry for mixing in trivial stylistic changes with serious open-heart surgery on mutexes.

It becomes difficult to see what is important, makes it harder to track changes, and increases the workload of the maint pumpking who has to try and merge this stuff.

So Jerry redid the patch to make it easier for people to follow along at home. Rafael smoked the patches on a hexaprocessor box, gave them a clean bill of health, and so they were applied.

  Flying colours

C++: Solaris CC now compiles "perl"

Jarkko Hietaniemi sent in an update concerning his work to get the perl sources compiling with C++. It caused the Win32 compile to bomb, so Yves Orton rewrote the nasty bits and got it to work.

And then some more from Jarkko:

Jarkko also rewrote the Encode-generated code to make it safe for C++ compilers.

How to handle (?=) and (?<=) properly

Yves Orton added more shiny goodness to the regular expression engine, this time boosting the performance of zero-width lookahead assertions. In the benchmarks that Yves had available, this was the last area where Python was previously outperforming Perl.

  Getting your bearings

Elsewhere around the engine, Yves started to add hooks into it to pave the way for making a pluggable regular expression engine. (Which may lead, for instance, to Yves and Dave Mitchell's work in blead one day making it back to maint. Or running the PCRE engine inside Perl).

VMS goodness for the Module::Build beta

Craig Berry sent Ken Williams a patch to reduce the number of failures observed when testing Module::Build. The situation is still not perfect, but Craig felt certain that this batch of changes would not create problems on other platforms.

Fixing \N{...} in regular expressions

A couple of months back, Sadahiro Tomoyuki showed that /a\N{PLUS SIGN}b/ is parsed as /a+b/ instead of the more Do-What-I-Meanish /a\+b/. Yves Orton delivered an impressive patch to correct that behaviour. Tomoyuki went through the patch with a fine-toothed comb and made many suggestions. H.Merijn Brand applied it.

  Unicode unified

Patching win32.c to fix bugs #38723 and #39531

Andrew Savige mailed in a patch to correct a couple of Windows bugs dealing with backticks. In fact, there were two patches, one for maint and one for blead. How thoughtful.

Yves went over it and gave it the thumbs up. Rafael took it for a spin on an SMP box but the tests would hang from time to time. But since there is a net improvement, it's all gone in, and the test has been marked TODO until such time as Yves or someone else can take a closer look.

Watching the smoke signals

Smoke [5.9.4] 28821 FAIL(XF) OSF1 V5.1 (EV6/4 cpu)

Jarkko discovered that Finnish locales, threads and regexps was a potent brew that caused all sorts of smoke to come flying out of his machine. Yves started to sift through the evidence to look for what was going wrong.

After a short while, he hacked up a quick and dirty fix that consisted of disabling study for UTF-8 strings. And after another look he didn't feel so bad about the idea, since the code seemed to indicate that it couldn't work anyway.

Rafael had another look at the patch that had given rise to the problems, and noted that it was only the test part of the patch that appeared to be in error.

Yves finally hit paydirt. The test was actually correct. The code was wrong. Looking at old patch from Ilya Zakharevich some time last century, where a change from double- to single-quoting of some embedded Perl code meant that from that time on, the test has been patiently studying a stringified reference instead of a reference to a string, and that UTF-8 and study has been broken forever. Jarkko was lost for words. But then quickly recovered and gave Yves his next challenge.

Jarkko and Yves then discussed how Perl should have really implemented UTF, properly. Yves hoped that the Perl 6 crowd have learnt their lessons well.

  I never liked studying, anyway

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

Sadahiro noticed a that a declaration list contained a statement, which is a no-no for some compilers. Once that was fixed the smoke cleared up.

Smoke [5.9.4] 28848 FAIL(Fm) OSF1 V5.1 (EV6/4 cpu)

Jarkko noted another failure, that occur when the locale in use uses a comma as a decimal point. This reminded H.Merijn Brand of Stupid Locale Tricks to try with Windows, and John Peacock wondered how he could better test to deal with this stuff.

New and old bugs from RT

ref counting bug (#21945)

Steve Peters thinks this is a heisenbug, so he asked for other people to take it for a spin, just in case he was seeing things (or not).

XSUB.h version check may fail due to locale (#37714)

Rafael hauled out a previously unknown macro into the light to fix up this bug. John Peacock was most appreciative, and begin to fold it into, when Rafael came up with an even better patch. So John patched Rafael's patch to do some other things he needed it to do.

-0.0 loses signedness upon numeric comparison (#39875)

Michael G. Schwern wondered why this bug was still open, since there's a patch ready and waiting to be be applied.


Re: File::Spec->case_tolerant() should return true on Cygwin (#40103)

Michael also wasn't sure what was case tolerant and what wasn't, at proposed a simple test to solve the issue.

  A sensitive matter

g++ 2.95.3 on Solaris 8 can't compile perl.h __attribute__ (#40317)

Christopher D. Malon was having trouble getting an old GNU C++ compiler to compile an XS module. No solution appeared to be forthcoming immediately.

Question? (#40322)

A question was asked about how to tell what nalloc routine was compiled into perl, and an answer was given.

Documentation patch for perlfunc.pod (#40327)

Merijn B. (the other Merijn) noted one passage in perlfunc concerning stat that was less than clear and proposed a fix. Applied by Rafael.

overload::Overloaded depends on bad Class->can (#40333)

Joshua ben Jore wanted to do some really weird stuff to overload::Overloaded, because he was trying to build an instant box of death. This would be used to help test to ensure that an introspective module doesn't trigger overloading or magic by accident.

pod2man output is hyphenated by groff (#40344)

hjp@yoyo noticed that the nroffish output produced by pod2man is incorrectly hyphenated by groff, and added the necessary nroff incantation to fix it up. Rafael noted that this is fixed by Russ Alberry's latest release of podlators.

Perl5 Bug Summary

12 down, 9 up, 1528 total, for an overall week-on-week decline for the first time in a while.


  and more stats

New Core Modules

In Brief

Turns out that Perforce does have flexible commit hooks to perform actions when a file changes.

Yet another person wondered how to deal with Storable version mismatches.

Jerry D. Hedden was looking at threads/shared/typemap. It was removed in a patch by accident, and then subsequently reinstated. Jerry wondered why, since it is a zero-length file that apparently serves no purpose.

And the patch to reinstate it didn't square with the APC ("Archive of Perl Changes") repository, and left the latter in an uncertain state.

Jonathan Rockway wanted to know whether one could compile Perl 5 for Qtopia devices. Paul Johnson provided a couple of tips.

Gabor Szabo wondered whether errors about the signedness of pointer targets in Normalize.xs in 5.9.4 were the same as those in Net::RawIP. Whatever the case, Gabor fixed the problem with a couple of casts.

Yves Orton finally became sufficiently annoyed by the mktables executes seven time per build mazurka and decided to do something about it. So he did. Yay! Rafael applied it. Yay!

Yitzchak Scott-Thoennes was looking at the ongoing coredumps in Cygwin and finally suggested a one-liner involving sv_setpvn and NULL. Applied by Rafael.

We are still looking for a volunteer to work with Klocwork in order to perform an analysis of perl code. (At the C side, that is).

Jarkko removed the probe for -Wdeclaration-after-statement from Configure.

Also, if your exotic platform has been having an environmental crisis with blead, it may be due to Jarkko's diddling of Perl_my_setenv(). So the diddling was undiddled.

Premchai noted that perlsec talks erroneously about a "Non-Finite Automaton" when in fact it should be talking about a Nondeterministic Finite Automaton.

In case you hadn't noticed, JPL (the Java/Perl thing) has been removed from blead and will not be present in 5.10.

Ben Morrow showed me a simple of trick to cope with what happens when perl headers conflict with systems headers.

David Nicol added a bit about B::Deparse's failure to grok outer lexical scopes in its BUGS section.

About this summary

This summary was written by David Landgren.

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:

This Week on perl5-porters (1-10 September 2006)

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.