This Week on perl5-porters - 7-13 June 2008

grinder on 2008-06-22T20:19:00

This Week on perl5-porters - 7-13 June 2008

This morning, clkao pinged me and mentioned that he couldn't get perlbug to set the From: header when sending a bug report. I promised him I'd take a look.

I opened up perlbug determined to add one line and send a patch. Somehow, I never got around to adding the line CL asked for... -- Jesse Vincent, getting a finger caught in the machine.

Topics of Interest

RT bugtrackers, note the changes in 5.10

H.Merijn Brand wished to draw attention to the main changes in the more complex structures derived from an SV, so that people who were going through tickets on RT would remember to keep an eye open for the types of problems this might cause on badly-written XS code.

Nicholas Clark and Reini Urban pointed out a few more gotchas.

  do the right thing
  http://xrl.us/et7qo 

autodie 1.10 BETA released

Paul Fenwick released a development version of autodie, complete with Fatal, the unauthorised edition.

  testers welcome, needed
  http://xrl.us/et7qu 

overload segfaulting

Ovid reported that a certain use of overload led to a segmentation fault. Various people reported that various platforms did more or less the same thing.

Rick Delaney solved the matter with with some minor changes to the code, the test suite and the documentation. Rafael checked it in.

  he made it look easy, too
  http://xrl.us/et7q2 

Enable getgrgid on VMS

John E. Malmberg implemented the getgrgid call on VMS. Craig Berry suggested some minor housekeeping tweaks and committed it to blead.

  http://xrl.us/et7q8 

Cwd::abs_path behaviour with non-existent paths

John E. Malmberg wanted to get realpath working on VMS, and wondered what the cross-platform concensus was for dealing with path specifications that don't exist. Once he had that information, he would be able to decide what would be best for VMS.

Early feedback showed that different platforms handled John's examples quite differently. Thus he felt free to go ahead and do what made the most sense on VMS.

  i did it my way
  http://xrl.us/et7re 


TODO of the week

A task that need a little sysadmin-type knowledge

Profile Perl - am I hot or not?

The Perl source code is stable enough that it makes sense to profile it, identify and optimise the hotspots. It would be good to measure the performance of the Perl interpreter using free tools such as cachegrind, gprof, and dtrace, and work to reduce the bottlenecks they reveal.

As part of this, the idea of pp_hot.c is that it contains the hot ops, the ops that are most commonly used. The idea is that by grouping them, their object code will be adjacent in the executable, so they have a greater chance of already being in the CPU cache (or swapped in) due to being near another op already in use.

Except that it's not clear if these really are the most commonly used ops. So as part of exercising your skills with coverage and profiling tools you might want to determine what ops really are the most commonly used. And in turn suggest evictions and promotions to achieve a better pp_hot.c.

One piece of Perl code that might make a good testbed is installman.


Patches of Interest

perlbug prose patch (and some evals, too)

It all started out when clkao wondered why it wasn't possible to set the From: header on a perlbug report. Jesse Vincent thought "ho ho ho, a five-minute, one-line patch sent to perl5-porters coming up".

One Saturday afternoon later, Jesse sent in a 740 line patch that did just about everything except just that, discovering that perlbug was in desperate need for some tender loving care.

Ronald J. Kimball greeted the patch enthusiastically and went through it with a fine-toothed comb adjusting various changes to Jesse's prose.

Jesse was still a bit doubtful as to how to write a patch for a PL file in the utils/ directory (since said files are used to generate the final program that gets installed). Craig A. Berry hinted darkly at how things were done in concrete bunkers at secret locations.

  now i have to kill you
  http://xrl.us/et7rk 

Jesse then set to work cleaning up the twisty maze of user prompt routines, all alike. Rafael tried to apply the patch but failed, since the target of Jesse's intentions was the post-generated file. Jesse pointed Rafaël to the previous patch that was to applied against perlbug.PL.

  perlbug prompting
  http://xrl.us/et7rp 

Jesse finished for the week by overhauling the code that does the mailing of the bug report. Reini Urban suggested using readline, to get rid of those pesky ^H characters that sometimes appear in actual bug reports.

Jesse was hesitant to entertain the concept of optional dependencies within perlbug, but admitted that at least things were getting to the stage where such a change would not be the major surgery that it would have been before he started cleaning things in the first place.

  maybe next week
  http://xrl.us/et7rv 

perlsyn: equivalent code for HASH ~~ ARRAY

brian d foy asked for clarifications on smart matching behaviour just after 5.10.0 was released. He returned this week with a tweak to the documentation.


  http://xrl.us/et7r3 

Readable assertion names

Reini Urban went on a spring clean to strip out the metasyntactic variable names used in assertion errors and replaced them with names that conveyed useful information. Minor discussion followed as to whether the macro names that Reini used would mask or shadow real variable names, but Reini thought everything was safe.

  http://xrl.us/et7r9 

He then carried on with the rest of the files and Rafaël applied all of it.

  http://xrl.us/et7sf 

testing $/ with in memory files

Bram had worked out a patch some time ago that addressed this problem, but had used $ENV{_} as a sneaky shortcut for the current process. After it was pointed out that this was highly non-portable he had switched to a more robust technique. Rafaël applied the latter version, but in the meantime Bram had noticed that the patch ran into difficulties with -Uuseperlio.

But that was ok, because Bram had a patch for that as well. So Rafaël applied it too.

  http://xrl.us/et7sm 

More COW lvalues

Reini Urban used -DPERL_DEBUG_COW and found a couple of macros that are used as lvalues. He was able to solve one issue easily, since an assigning macro existed, but he was stuck as to how to rewrite SvIVX(sv_dat)++ in a safe manner.

Nicholas Clark had a look, and noticed that the end result boiled down to a = a + 1, and gcc's optimiser (at least) reduced that to the same assembly instructions as a++ and concluded that it was safe to use an apparently long-hand macro assignment, since it would wind up as a simple post increment.

  http://xrl.us/et7sq 

.gitignore file

Paul Fenwick develops with git, and thus is endlessly annoyed by git moaning about files it encounters but doesn't know what to do about them. So he wrote a crude .gitignore file to teach git to not pay attention to them.

Rafaël had admitted planning doing such a thing, but was waiting until 5.8.9 was out the door. At the same time, he thought there existed a certain opportunity for factoring Paul's list through the judicious use of wildcards.

Sam Vilain took Paul's list and laid some serious ignore-fu upon it.

  http://xrl.us/et7sw 


New and old bugs from RT

attributes don't like .= (#3605)

Bram made the distinction between my $var : locked .= "test" (a syntax error) and my $var .= "test" (legal, and does the Right Thing) and wondered whether the inconsistency should remain.

  http://xrl.us/et7s4 

Subroutine doesn't create elements (#8910)

Renée Bäcker had a look at one of Abigail's old bugs and added one more piece to the puzzle, but perhaps not enough to say it was resolved.

  http://xrl.us/et7ta 

sub foo(@$) {} should generate an error (#36673)

Rafael Garcia-Suarez took Renée's patches for this bug report, reworked them slightly, and applied them to blead.

  http://xrl.us/et7te 

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

Bram asked other people to check this old bug issued by Yves Orton, presumably because he could no longer reproduce the crash. Both Steve Hay an Niko Tyni reported that the test program ran without flaw.

  http://xrl.us/et7tk 

SIGTERM not terminating child process (#49073)

Jerry D. Hedden reworked a test in Time::HiRes so that it would play nicely on Cygwin. Patch not applied (Time::HiRes is now maintained by Zefram).

  http://xrl.us/et7tr 

length($@)>0 for empty $@ if utf8 is in use (#51370)

Bram brewed up a fix for this bug, that Rafaël applied, albeit with the uppercasing of a utility macro.

  http://xrl.us/et7tx 

Trying to build perl5.8.3 under Maemo environment (#53328)

Bram suggested a bette diagnostic for Cwd that would report where the program had looked for the pwd external binary, along with a short summary of what steps could be taken to fix the problem.

  http://xrl.us/et7t5 

Perl 5.10 segmentation fault using Net::SSH2::Channel (#54908)

Sebastien Rodriguez followed Ævar Arnfjörð Bjarmason's advice, which seemed to be essentially a diagnosis of the problem, and reported that things now worked. Hence his wish to contact the module author in order to push the change upstream.

  http://xrl.us/et7t9 

'once' warnings from xs modules in perl 5.10.0 (#55550)

This is the bug that Chia-liang Kao opened for the problem of XS modules producing "only used once" warnings in 5.10 and beyond.

  http://xrl.us/et7uf 

Recursive multithreading causes massive amounts of context switches (#55560)

Rafaël Garcia-Suarez explained, until a Copy On Write scheme is implemented in Perl, large numbers of thread creations will remain expensive.

  go iterative, young man
  http://xrl.us/et7um 

IPC::Open3 does not auto-create an error handle (#55570)

"Fiji" wondered why a simple call to IPC::Open3 never has the child's STDERR being connected to the lexical variable that is supposed to hold it. Looking at the code, it was clear why it didn't work, but the question was should the documentation be clearer, or should the code be changed.

Bram thought that is was doubtful as to whether the behaviour could be changed, since there may be people that have written code that depends on how things work currently.

Ben Morrow agreed that refining the POD was the only course of action, although Rafaël suggested that an API shift could be handled in a dual-life version.

  http://xrl.us/et7us 

Renée Bäcker supplied a patch to change the behaviour, and it was up to Eric Brine to explain that the crux of the matter was that the behaviour should not be changed. Instead, Eric showed how to solve the problem with a teeny amount of client make-work code.

  the correct use of gensym()
  http://xrl.us/et7uy 

Regexp optimization affected by threads (#55600)

John Gardiner Myers showed that when the regular expression engine is passed a pattern containing character classes (e.g. [a-e]+), the performance becomes abysmal if the call is issued from within a thread. John traced the problem to the code path not ever hitting the find_byclass routine which causes it to rely much more heavily on the backtracking mechanism.

  http://xrl.us/et7u6 

free from wrong pool on Fedora 6 (#55658)

Jason Van Dias sent in a reasonably concise test program that showed how to generate a panic in perl 5.10.0. Nicholas Clark pointed him to the latest source of the 5.10 track (which will become 5.10.1).

Jason took that for a spin, and the only result was that the coredump message changed slightly. He had to tweak the Perl source slightly to get it to work at all. He noted that everything was fine with 5.8.4 and 5.8.0 on other platforms.

  http://xrl.us/et7va 

evaling a certain format string segfaults perl (#55668)

Arthur Kantor showed how a poorly formatted format string kills perl. Alexandr Ciornii replied that the problem was fixed in 5.10.

  http://xrl.us/et7vg 

Synopsis documents (deprecated, fragile) indirect object syntax (#55708)

Michael R. Wolf filed a bug report to change constructs like new Dumpvalue to Dumpvalue->new. Ilya Zakharevich pointed out that both constructs are flawed, that the more robust < Dumpvalue::- new() >> construct isn't understood by older perls, leaving only the slightly horrendous "Dumpvalue"->new().

  cpan RT #36694
  http://xrl.us/et7vn 

Perl5 Bug Summary

  265 new + 1276 open = 1541 (+5 -21)
  http://xrl.us/et7vt
  http://rt.perl.org/rt3/NoAuth/perl5/Overview.html 


New Core Modules

Pod::Perldoc version 3.14_07

Adriano Ferreira had Rafaël synch blead with the latest goodies from CPAN.

  http://xrl.us/et7vx 
threads 1.71

Jerry D. Hedden needed a couple of iterations to get the latest POD and test tweaks sorted out, but it was applied in the end.

  http://xrl.us/et7v5 
threads::shared 1.22

This module also received similar treatment.

  http://xrl.us/et7v9 
Thread::Semaphore 2.09

  ditto
  http://xrl.us/et7wb 
Thread::Queue 2.11
  ditto
  http://xrl.us/et7wh 
B::Debug 1.06

Reini Urban asked if it would be possible to synch the CPAN version of B::Debug with blead, and Rafaël was happy to oblige. So now B::Debug is officially dual-lifed.


  http://xrl.us/et7wm 


In Brief

Renée Bäcker announced that bugs #3176, #3495, #3534, #5246 and #6783 were either fixed or non-bugs.

  look them up on RT

The problem with porting perl on Armel (bug #55038) inched one step forwards this week.

  http://xrl.us/et7ws 

I suspect that Panic in regex processing (unknown regstclass 0) (bug #55466) does not concern the porters directly.

  http://xrl.us/et7ww 

Craig A. Berry and Aaron Crane continued to delve into the subtleties of File::Copy and permission bits.

  generally impossible
  http://xrl.us/et7wy 

Steve Hay added some code to remove temporary files left over by test in IO-Compress-Zlib , which Nicholas Clark applied.


  now to inform Paul Marquess
  http://xrl.us/et7w6 

Steve also had some code added to fix run/switches test on Win32.

  blindly applied
  http://xrl.us/et7xa 

David Nicol thought about what it would take to write a state machine for parsing Perl; Ben Morrow pointed him at PPI.

  unreinventable wheels
  http://xrl.us/et7xg 

John E. Malmberg reported that VMS passes these t/io/open.t tests now so there is no longer any need to skip them. Unapplied, apparently.

  http://xrl.us/et7xn 

Andreas König wondered if he was the only person with a failing syslog test in current blead; Bram reported that he was in good company.

  http://xrl.us/et7xt 

Mattia Barbon encountered problems using wxPerl playing around with setenv and putenv, and traced it down to an interaction between DEBUGGING and PL_use_safe_putenv. A quick edit to wxPerl solved the immediate problem, but Mattia wanted to know if there was a better underlying solution waiting to be found.

  http://xrl.us/et7xz 

John Peacock had a self-referential version.pm question, wondering what was the best way of delivering a POD-only improvement release. Eric Wilhelm pointed out a possible gotcha.

  debian does it differently
  http://xrl.us/et7x7 

Last week's summary

  This Week on perl5-porters - 1-6 June 2008
  http://xrl.us/et7yb 

About this summary

This summary is dedicated to the recent addition to Rafaël's family:

  http://flickr.com/photos/rgarciasuarez74/tags/fran%C3%A7ois/ 

This summary was written by David Landgren.

Weekly summaries are published on http://use.perl.org/ and posted on a mailing list, (subscription: perl5-summary-subscribe@perl.org ). The archive is at http://dev.perl.org/perl5/list-summaries/ . 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.