Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

This Week on perl5-porters - 11-17 May 2008

posted by grinder on 2008.05.24 14:18   Printer-friendly

This Week on perl5-porters - 11-17 May 2008

Dominic Dunlop: Trouble is, some of it is CGI, and people whinge loudly when previously-clean CGI starts warning.

Ed Avis: Ha ha ha. I think any possible programmer mistake can be found in a Perl CGI program somewhere.

Topics of Interest

5.8.9-to-be on Irix

David Cantrell took the time to track down the failures (regarding Sys::Syslog) with the upcoming 5.8.9 release. Versions 0.13 (bundled with 5.8.8) through 0.18 both pass on 5.8.8 and 5.8.9-tobe on Irix. 0.19 and beyond fail on both versions. But 0.24 (the current version) does pass on platforms other than Irix.

David provided an additional clue, in that the compiler moaned that something was wrong with a variable named RETVAL (a name that will strike fear into any author starting out in XS).

Sébastien Aperghis-Tramoni, the current maintainer, wailed in despair, since 0.18-0.19 was a monster release, introducing support for the Win32 platform. After a couple of hours of serious work (and some minor goofing off), he offered a Subversion version for David to try. David announced that it worked, although the compiler was still a little suspicious of RETVAL. Sébastien fixed that as well.

And Sébastien will buy David a beer at the next London Perl Workshop.

  you know this will go down on your permanent record 

File::Path::mkpath() incompatibility in perl-5.10

Gisle Aas ran into grief over old-style/new-style interface for File::Path. As a result, David Landgren learnt that sometimes it doesn't pay to be too Clever when trying to introduce new features while maintaining pure backwards compatibility at the same time.

Thus, the next release of File::Path will guarantee total backwards compatability, and those wishing to live on the cutting edge will have to say so, one way or another. 

On the almost impossibility to write correct XS modules

Hmm. Lot of traffic next week on this one (sometimes it comes in handy to run late). 

eval "require Foo" with binary-incompatible XS modules

Niko Tyni was running into problems setting up Debian packages in order to upgrade from 5.8.8 to 5.10.0. The main reason being that Debian don't use a $Config{vendorarch}, which was designed to resolve the problem of keeping binary-incompatible XS code apart.

There were a number of suggestions as to what could be done to fix up the situation, but Nicholas Clark was hesitant to endorse any of them, pointing out quite rightly that Debian had already survived the 5.6-to-5.8 upgrade. 

Method call overloading

Following on from last week's musings, Ricardo Signes released a first cut at testing method call overloading to allow one's own dispatching techniques.


After pondering the issue for a couple of hours, he released a second version with a new, improved class-based scheme. Unfortunately, in Ricardo's eyes, the syntax sucks. With a bit of encouragement from the parser, it might be possible to come up with something beautiful.

  classy work 

Division by zero folding deferred to run-time

Eric Brine wondered what the reasoning was behind deferring constant folding (such as 1/0) until run-time, when it could be caught at compilation time (as, in fact, it used to in 5.8).

Nicholas Clark explained that the concept as such was an optimisation, and as such it should not affect the behaviour of a program. For instance:

  print 1/0 if $ARGV[0] > 10;

... could not be compiled at all on 5.8, even though in some circumstances the code may never be executed in the first place.

The point in question is that such a construct might be hidden behind two constants subs that have different values depending on the platform the code is running on. In that case, the code might be uncompilable even though the program itself could run perfectly well.

  early decisions bad, late decisions good 

Compiling perl (5.10.x) with gcc <= 3.2.3

After sparring with the RT bug database, Bram began to install as many versions of gcc as he could lay his hands on, to see how they fared compiling perl.

When he got as far back as version 3.2.3, the Configure and make succeeded, but the test suite spat out numerous " cannot open shared object file" errors.

Andy Dougherty suggested a riff on the -fstack-protector problems seen elsewhere this week, but that didn't do any better. Since the compiler in question was released five years ago, Andy suggested just adding a note in the INSTALL file.

H.Merijn Brand committed change #33841 to note the fact in README.linux, but wasn't really happy with the idea, since gcc runs on other platforms as well. But that's ok, because he will have to revert the change, since Bram figured out a simple recipe that allows 3.2.3 to work. 

Empty pattern and /o

Bram lifted an old bug out of obscurity, concerning the empty pattern (//) and the /o modifier, the point in question being the interactions observed when use re 'eval' comes into play.

Yves Orton grumbled that all these things were complicated to begin with, so one can grasp the potential for mischief when they interact in a single expression.

Abigail thought it would be nice to downplay the importance of /o in the documentation, since it invariably led people to find out about it, and then proceed to use it incorrectly.

Similarly, Abigail thought that // (match again with the same pattern that was used previously) doesn't have any use in the real world; most canonical examples being somewhat contrived. What does happen with annoying regularity is that people use /$var/, and $var turns out to be empty, thus triggering an unexpected action at a distance.

Yves Orton wanted to make /o a true no-op, and make the magic empty pattern behaviour only kick in if the pattern was well and truly a // as parsed. And it probably comes as no surprise that Yves had a couple of perfectly reasonable use cases where // patterns are very useful:

  if (m/$some_big_nasty_pattern/ and $1 eq $something) {


  if (m/$pat1/ or m/$pat2/ or m/$pat3/) {

Yves was careful to point out that he only used empty pattern magic with the substitution operator. For the match operator, he thought the empty pattern should warn all the time.

And /o can't be no-op'ed just yet, since it still adds a tiny smidgen of performance, even in 5.10. So first of all Yves needs to fix the underlying problems that make it useful in the first place, at which point it could be deprecated. 

TODO of the week

Remove duplication of test setup

Schwern notes that there's duplication of code - lots and lots of tests have some variation on the big block of $Is_Foo checks. We can safely put this into a file, change it to build an %Is hash and require it. Maybe just put it into Throw in the handy tainting subroutines.

Patches of Interest

Add Some Links to External (WWW) Resources to the Perldocs

Shlomi Fish responded to the criticism of his patch (it should not be accepted since it has a higher maintenance burden due to linkrot), arguing that a quality product requires maintenance, and a high quality product requires more maintenance.

Quoting Nicholas Clark:

There is a fundamental conflict in the Perl documentation as is. People are tugging it in both ways - it's trying both to be a reference manual (terse, to the point), and an introduction/tutorial.

It can't be both. It certainly can't be all things to all people. [...]

We have to assume some level of intelligence on the part of the readership. If they don't know a concept, they will be smart enough to research it for themselves.


Compress/Raw/Zlib/Zlib.xs // comment fix

Andy Dougherty replaced some C++ comments with good old-fashioned C comments. Paul Marquess thanked him and updated his own repository. H.Merijn Brand applied the change, and idly wondered whether it will be possible with git to reject a patch that contains such base sins.

  /* TIOOWTDI */ 

h2ph: recognise the quote mark delimiter on #include directives

Niko Tyni saw that h2ph had trouble when system headers include file names in quotes rather than angle brackets. He wrote some code to fix up the problem and this allowed a number of regexp experts to show off their skills. In the process, the patch was thoroughly reviewed and made it in.

  #include "peer-review.h" 

New and old bugs from RT

uc/lc/ucfirst/lcfirst fail on typeglobs (#39019)

Bram tried to sneak this one past as being resolved, since it certainly looked like it. Nicholas Clark disagreed, explaining that there was a problem with it, although likely one that only he could fix.

So Bram asked Nicholas to explain more clearly what the problem was, or rather, given what input produces incorrect output?

  an open question 

bleadperl -Dm -e1 segfaults on win32 (#39806)

Bram asked for Win32 porters (which these days is Strawberry, right?), and/or Linux+threads porters to see if this problem persists.

  call me in the morning 

glob() should do taint checking (#39821)

Bram asked for a resolution on this issue. Andy Dougherty replied that functions don't fail on tainted args unless they have an impact on the outside world. glob pulls information in from the outside world, so we don't care about what we ask of it. On the other hand, what glob returns is viewed with the utmost suspicion.

  live free or die 

Bug in File::Find on Windows when targetdir is bare drive letter and no_chdir = 1 (#41555)

Bram implemented David Landgren's suggestion (or something resembling it) to create a regression test for the code to deal with a directory search starting with a volume name and a relative directory (that is, something like D:right\here.

Rafael thought the patch looked sane enough to apply; the smokers will soon find out if it causes severe burns. 

NDBM_File fails to build (#50180)

Andy Dougherty created a pair of patches to teach NDBM_File how to build itself, and he believed that the patches were safe to apply to all perl versions. H.Merijn Brand applied the patch to blead. 

Deparse interpolation in regex literal (#51848)

Ambrus Zsbán had filed a report about B::Deparse failing to restitute /${x}y/ correctly. Rafael Garcia-Suarez commented this week, saying that it failed because the optree was missing an op_concat, and this threw everything else off. Rafael proposed a first fix, with ugly cutting and pasting, but then sat down like a good boy and did a proper refactoring and wrote some regression tests as well (change #33851).

This did lead him to wonder, all the same, why the opcode was no longer there. Yves Orton blamed Dave Mitchell. Dave replied saying that yes, it was his fault. The change was a result of some initial work some time ago to make (??{...}) work better. The idea is to had the regexp compiler a list of tokens that comprise the code block, instead of a single blob of uselessness. 

op/pwent.t should use the DirectoryService on OS X (#53500)

Tom Wyant read about this problem in the perl5-porters summary, and was inspired enough to write a patch to fix the issue. Yay him! Rafael applied the patch to blead, hoping that no Leopards, Tigers or other such beasts would be hurt in the process.


elseif should be elsif (#53808)

Ben Aveling got mixed up between Perl and Ruby or PHP or ASP or TCL or not Javascript and wrote elseif instead of elsif. Instead of receiving a boring syntax error, Ben was slightly puzzled by the fact that he received an explicit recommendation to change elseif to elsif. His reasoning was that if the lexer is so smart to second-guess the programmer, why not just emit the elsif token and be done with it.

Abigail pointed out that doing this would break any code that defined a sub named elseif (although it could be argued that any programmer doing so should be taken out the back and beaten severely about the head with a blunt object). David Nicol gave Macrame a plug, showing how one could write a macro for this situation. Yitzchak Scott-Thoennes pointed out that a language change of this nature would break syntax-highlighters.

  we'll leave it at that 

Bug in Time::HiRes 5.11 (#53962)

Dmitry Karasik thought he found a bug in Time::HiRes on 5.10 and blead (bug #53962) and thought the underlying code looked pretty horrible. Dominic Dunlop replied that many different systems handle high resolution time measurements in many weird and wonderful ways.

Given this extra bit of information, Dmitry was able to refine his patch. But the patch didn't solve Reini Urban's ongoing Time::HiRes failures on Cygwin.

  adapt to reality 

pod2man nroff =head2 with two C<> blocks (#53974)

Kevin Ryde looked at a POD heading with two C directives and noticed that the bold was switched off after the first one. He was brave enough to delve into Pod/ and produce a patch that fixed things up.

Unfortunately he wasn't entirely certain that this wouldn't cause problems elsewhere, and the copious tests available did not help clarify the issue. 

Respawning processes with negative return values on Win32. (#54028)

Alistair showed how a very short C++ program whose main claim to fame was to return -1 as a status code to the operating system could be called twice, even though the Perl code contains only a single system call. He delved into the code in win32.c and found some suspicious code that appears to interact with $!.

  skeletons in the closet 

Misparsing of sort comparison subroutine intention (#54040)

Ken Williams tripped up over the difference between the use of a function used to compare pairs in a sort and sorting the results of what a function returns. David Nicol was hard pressed to classify the problem as a bug from either a documentation or implementation standpoint.

Aristotle Pagaltzis admitted to having been bitten by the bug before, Abigail suggested using the secret + operator to disambiguate the meaning. David finished with a revised wording for the documentation, and there the thread ended.

  care is required when sorting the list returned from a function 

usethread=no Configure compiler test file try.c is missing. (#54042)

Reini Urban saw that deactivating threads with MAD triggered an internal Configure script bug, and so he reported it. Alas, no porter with sufficient Configure-fu responded.

  please report this 

perl -wle '%::=();//' crash (#54044)

Reini also recorded the fact that resetting the main stash and then running an empty match will cause perl to dump core. He wasn't sure which way out was the best, but thought that he could do better than just segfaulting.

Yves Orton recalled reading about someone who built up some Markov chains using real Perl code to produce slightly bogus code to try and trigger segfaults. Nicholas Clark pointed Yves to the perl5-porters post, a mere five minutes later.

  match my stash 

semi-panic: attempt to dup freed string (#54114)

Nicholas Clark suspects this bug is yet another case of the stack not being reference counted.


Need more -fstack-protector (#54120)

Andy Dougherty sent in a patch to fix up undefined symbols from occurring when -fstack-protector is used. The correction was to use compiler flags to ensure the use of the switch was propagated out to XS modules.

Nicholas Clark pointed out a flaw in the plan that forced Andy back to the drawing board. 

IO::Seekable + POSIX == constant subroutines redefined (#54186)

Niko Tyni showed how the incestuous relation between (what in fact actually turned out to be) Fcntl and POSIX would generate lots of messy warnings.

Nicholas Clark fixed things up so that POSIX now imports what it needs from Fcntl instead of reinventing wheels badly. In the process of cleaning things up, he realised that there was scope for doing the same kind of decrufting elsewhere in the codebase, which should worth another TODO. 

readlink() returns result along with garbage (#54198)

Denis Melnikov noticed that using readlink in the Linux /proc filesystem can lead to some strange results. After some investigation it was decided that the observed behaviour was quite appropriate.

  although not really documented 

segfault in perl_clone(), probably due to running out of memory (#54224)

This week, Niko Tyni also uncovered another way to generate a segfault, but admitted that it wasn't a very important issue.

  but a core dump is a core dump 

Panic opt close in regex /(?:(o){2})?/ (#54228)

Niko also rediscovered the bug involving a capture group and a curly specifier in a regexp. Apart from the fact that no-one can provide a definition of what such an expression should do, it certainly shouldn't dump core.

David Landgren grovelled through his memory and old summaries and identified bug #39233 as an earlier instance of the same underlying problem. Yves Orton assigned himself the bug so as not to forget about it. 

Perl5 Bug Summary

Bram's been busy again this week.

  279 + 1383 = 1662 (+8 -44) 

New Core Modules

threads::shared 1.21

Jerry D. Hedden shares some more threads goodness. 
Thread::Queue 2.08

and this allowed him to push a new release of this one, too. 
IO::Compress::* 2.011

Following on from the C++ comment, Paul Marquess release 2.011, which also fixed a slew of problems reported on RT. 

In Brief

(My damned wireless network at home kept flaking out this week, causing my ssh sessions to die. At some point during an evening's summarising, I noticed that the file was truncated right about here. I've restored the rest of it from a backup, but some items I wrote between then and now were wiped out. Sorry about that. Since what goes here is usually short, and resolved, it's not so bad).

Rafael Garcia-Suarez took chromatic's patch to add ..., !!!, and ??? operators and applied it.

  I want a blah blah blah operator 

Reini Urban pleaded for the change that fixes the crash when localizing a symtab entry (bug #52740) to be backported to 5.10.x.

  one for Dave 

Yves Orton announced that he was out of action but back in the saddle again a bit. Marvellous. Now he'll go and add a slew of regexp verbs, and I still haven't digested the first lot.


Bram says bleadperl crash in Perl_pp_entersub() (#40493) is fixed. 

Bram looked at a perl -d bug on Mandriva Cooker with 5.8.8 (bug #39758) and said it looked pretty good (although the jury was still out on 5.8.9-tobe)

  so, the smoke finished? 

He also delivered some promised TODO tests to record the fact that print Does::Not::Exist, '' does, when it shouldn't (bug #53806). 

He also repackaged another suggestion from a previous week concerning the AIX Hints file (libm package).

  awaiting comments 

Bram wrote a documentation patch to clarify the use of reverse in scalar context. Yves applied it. Which allowed Bram to close bug #39187. 

Edward Peschko wanted to know if a particular debugger that promised seamless XS debugging ever made it out into the wild. 

Matt Kraai made some edits in the FAQ to link perlfunc to the correct section of perlop .

  q//, qq//, qx//, and qw// 

Last week's summary

Hmm, seems it never made it to the list. It did turn up on summary-only mailing list if you need to hunt down a copy. And yes, the archive on is not being updated. I'll get to that... eventually.

About this summary

This summary was written by David Landgren.

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 or attending a YAPC to help support the development of Perl.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.