This Week on perl5-porters - 20-26 October 2008

grinder on 2008-11-04T23:54:00

This Week on perl5-porters - 20-26 October 2008

"So we have an existing bug. Sometimes \400 matches \400, and sometimes it matches \01\00, depending on what I would call spooky action at a distance. I'm trying to get rid of these inconsistencies. I think something should be done here, but perhaps its not what I thought it should be. My patch follows what the code was intending to do, but perhaps we should change that intention. Please guide me." -- Karl Williamson, trudging around in the depths of Unicode.

Topics of Interest

Exported symbols: the perl API

H.Merijn Brand shared with us one of the more exciting aspects of configuring perl. The embed.pl program goes through the source and pulls out the name of every function marked as public and saves them in global.sym.

H.Merijn discovered that there's no test to check see if what is found is truly available. Configure a perl with -Duseshrplib for example, and many are not.

Using some unportable code, he whipped up a program to list everything that was supposed to be available but wasn't. He wanted to know if a Windows expert could code up something similar that would work on that platform.

  http://xrl.us/owao2 

blead smoke failures for Module::Build

Nicholas Clark ran into inconsistencies with $^X (the name of the perl binary) but got things sorted out. I'm not sure if Ken Williams pushed the changes upstream to his repository.


  http://xrl.us/owao4 

git-info

Michael G. Schwern lamented the lack of an equivalent command in git for svn info, so he wrote an analogue in Perl. Aristotle thought that he had just reinvented EasyGit. Michael had a look, was impressed, but decided that the information eg info produced wasn't of vital importance.

  http://xrl.us/owao6 

FreeBSD 7 libc_r detection

Tony Cook supplied a very welcome patch to solve the problem of configuring perl on FreeBSD 7 with threads, when the threads compatibility shims are not installed. Chris Williams had a feeling that this would allow bug #57458 to be closed.

So Chris set about checking the results and confirmed that the patch was good and the bug was dead.

  http://xrl.us/owao8 

Problems attempt to load Storable

While Storable was the symptom, the cause was trying to compile XS extensions with Sun's C compiler for a perl 5.6.1 compiled with gcc.

Nicholas Clark wrote an elaborate recipe for modifying Config.pm to make things work. Andy Dougherty thought that it all made sense, but both were in agreement that the easiest way forward for Tim Smith, who posed the question initially, would be to recompile everything with Sun's compiler.

  http://xrl.us/owapa 

PL_ors_sv in Devel::PPPort

H.Merijn Brand needed to perform a localised undef $\, which was trivial under 5.8.x and beyond, but just about impossible under 5.6 due to radical differences in the underlying implementations.

He wondered if there was a way of pushing the problem off onto Devel::PPPort. Marcus Holland-Moritz thought it was pretty much impossible. H.Merijn contented himself with marking the module as unsuitable for use with 5.6 and below.

  upgrade already
  http://xrl.us/owapc 

DLL error messages installing Term::Title under Cygwin

Ruben Diez asked for help in figuring out a strange error with a fresh installation of Perl on a fresh copy of Cygwin running on Vista.

Alexandr Ciornii and Reini Urban diagnosed this as a rebaseall problem, and therein lay the solution.

  http://xrl.us/ovihr
  http://xrl.us/owape 

perl@34559

Nicholas Clark produced what he fervently hopes is the last snapshot for perl 5.8.9, with six issues outstanding. If anything else is broken, it will be for anyone else to fix.

Slaven Rezic posted an impressive list of modules that he had tested against recent versions of 5.8-maint, and he and Nicholas went through them. A number of failures were deemed acceptable, since they represented the nailing down of greyer parts of the implementation. Other failures were due to relying on implementation bugs that were also fixed.

Of the six main problems, David Landgren posted updates for File::Path and Ken Williams gave p5p co-maintainer status for Pathtools.

Modules were looked at, such as IO::Mark, constant and Business::ISBN. SUPER method caching was examined, as were format references.


  http://xrl.us/owapg 

Next API question for Devel::PPPort

H.Merijn Brand wanted to be able to rely on Perl_pv_pretty and Perl_pv_escape in any version of Perl. Marcus Holland-Moritz initially said that it would be difficult, but went ahead and did it anyway. This now gives H.Merijn a pv_display that does UTF-8 right.

  http://xrl.us/owapi 

Possible mro bug/change between 5.8.8 and 5.10.0

Michael G. Schwern pinned a problem in DBIx::Class::CDBICompat to a change in behaviour of MRO (method resolution order). Nicholas Clark hoped that Brandon Black, author of mro.c would be able to shed some light on the matter.

Matt S. Trout said that Brandon hasn't been available to look at Perl stuff for months and so he would try and find the time to look at it, but didn't make any promises as to when that could be.

  http://xrl.us/owapk 

How to get Test:: to output in utf8

Karl Williamson wanted to get UTF-8 output from Test::More but was stymied by Wide character in print warnings. Michael G. Schwern offered a couple of tips to get it to work.


  http://xrl.us/owapn 

Change 34559 oddity

Slaven Rezic wondered if the patch for FreeBSD and the legacy thread library was meant to apply to 6.x or not, since there was a discrepancy between the log message and code.

Nicholas admitted that the patch was wrong and 6.x was being treated the same way... but since things continued to work on 6.x, he wasn't sure whether to take it out or leave it.

  http://xrl.us/owapp 


TODO of the week

A new task that only need Perl knowledge (and an ability to use grep or ack).

Parallel testing

(This probably impacts much more than the core: also the Test::Harness and TAP::* modules on CPAN.)

All of the tests in t/ can now be run in parallel, if $ENV{TEST_JOBS} is set. However, tests within each directory in ext and lib are still run in series, with directories run in parallel. This is an adequate heuristic, but it might be possible to relax it further, and get more throughput. Specifically, it would be good to audit all of lib/*.t, and make them use File::Temp.


Patches of Interest

Revert const'ing in cygwin.c

Changes to blead and backports to 5.10 left some consting problems that caused the compiler to grumble a bit. This patch was to clean up the warnings on 5.10, and appears to be Warnocked.

  http://xrl.us/owapr 

Refactor Perl_mem_log_* functions

Marcus Holland-Moritz discovered a nest of duplicate code in various logging functions, and factored out what he could into a workhorse function. He hinted that this patch needed to go in, so that he could deliver a putative "SV allocation tracing" patch.

  http://xrl.us/owapt 

Add SV allocation tracing to -Dm and PERL_MEM_LOG

Despite receiving no feedback from the above patch, Marcus went ahead and applied his SV tracing patch. This works by adding an additional field in debugging build to SVs, in which a unique serial number can be stored.

When a leak is spotted, the serial number can be read. The code is run a second time, this time setting a break-point on new_SV() watching for the creation of the SV with the same serial number. From there it usually become a trivial matter to work out who's responsible for making the mess.

  http://xrl.us/owapv 

Fix prototype detection for C++

Marcus Holland-Moritz isolated a problem with incorrect function prototypes for C++ and suggested an improvement. H.Merijn Brand, as Configure pumpking was a bit concerned since the change would have a potentially large impact. But as it turned out, the fact that he had switched Configure over entirely to git simplified the house-keeping tasks considerably.

  http://xrl.us/owapx 

Use of freed comppad array during clear_yystack()

Marcus Holland-Moritz spotted a bug that using PERL_POISON picked up. (That is, filling the contents of deallocated pointers with garbage to trigger segfaults from attempts to dereference said freed pointers).

The problem was that a variable was freed, set to NULL, and freed again. And in real life this works out nicely.

But for the sake of correctness, Marcus wrote a patch to make things work correctly, whether PERL_POISON is defined or not.

  http://xrl.us/owapz 

Not silently casting away constness in SV macros

Marcus also noticed that change #34600 corrected an erroneously consted SV, and reflected that such problems can lie buried for a long time since macros like SvREFCNT_dec blindly cast away constness, thus preventing the compiler from doing the job we asked it to do in the first place.

So he thought about how one might go about fixing it, and came up with some more preprocessor trickery that would allow the compiler to spot when constness was being cast away.

Nicholas Clark thought that this was a great idea and committed a patch to implement it. He then began to start using it, and it allowed him to fix up some problems straight away.

  http://xrl.us/owap3 


Watching the smoke signals

Smoke [5.11.0] 34541 FAIL(F) MSWin32 WinXP/.Net SP3 (x86/2 cpu)

Steve Hay's smoke was failing, but Steve wasn't around, so Nicholas Clark asked for someone else with access to Windows to run the tests and provide the details to understand what was going wrong. Tony Cook dug down and found that it was due to an undefined subroutine &Cwd::getdcwd.

This allowed Nicholas to understand what was going wrong and suggest a fix, and Tony reported that it was good.

  http://xrl.us/owap5 


New and old bugs from RT

Threads support in FreeBSD 7.0 (#57458)

Renée Bäcker wanted to know if the recent Configure-fu for FreeBSD solved this bug.

  http://xrl.us/owap7 

Feature request: regexp flag to not set $1, $2 etc. (#58072)

Ed Avis asked if it was possible to not set $1, $2 and the like during a pattern match with captures. He listed three bug reports in the RT queue about them getting clobbered.

Abigail explained that this was already possible, and showed how. Norbert Buchmuller mentioned that he had patched NEXT.pm using the same technique (and this was one of the cited bug reports) but was waiting for someone to review (and apply) the patch.

  http://xrl.us/owap9 

C coding questions for Unicode problem (#58182)

More bikeshed discussions continued this week on how to name Karl Williamson's Unicode fixup pragma.

  http://xrl.us/owaqb 

PerlIO::via leaks memory at a high rate (#59268)

Nicholas Clark looked at the problem that Marc Lehmann had uncovered, and regretted to say he wouldn't be able to fix it properly in time for 5.8.9. All is not lost though, since he thought it should be possible to push out a new version via CPAN at some later date.

  http://xrl.us/owaqd 

chr(0400) =~ /\400/ fails for >= 400 (#59342)

Karl Williamson produced a one-line fix for this problem, and Tom Christiansen wondered if this introduced yet another meaning to octal representations, backslashed or otherwise. Karl responded that it was already a mess and he just wanted it cleaned up.

Glenn Linderman suggested that a better alternative would be to outlaw octal escapes larger than \377 on 8-bit-byte platforms (as one can always work around that by using hex encodings).

Abigail, not usually known to be fond of adding new warnings to old behaviours thought that in this particular case it might be worth spitting out a warning if an \NNN octal escape (where NNN is greater than 0377) is found in a regular expression, on the basis that it would probably point out buggy assumptions.

All the people who responded were in favour of Karl's patch being applied.

  http://xrl.us/owaqf 

return 0 or die (#59802)

Dr. Ruud coaxed some examples of this construct from real code via a web search.

  http://xrl.us/owaqh 

Core on syntax error! (#59950)

Nick Kostirya stumbled over a coredump when he used a full colon instead of a semicolon for use Data::Dumper;. Dave Mitchell replied that this has been fixed in 5.10.0.

  http://xrl.us/owaqj 

Typo in perldata (#60022)

Ryan Dilworth pointed out an inconsistency in perldata regarding arrays, offsets and entries. Daniel Frederick Crisman proposed a patch to clarify matters and Marcus Holland-Moritz applied it.

  http://xrl.us/owaqm 

(?>) causes wrongness on long string (#60034)

Zefram pointed out a problem with the ?> assertion showing up in 5.10.0. Abigail thought that this was due to a variation on the theme of leaky implementation details, like the way A* is implemented as A(between 0 and 32767 times). Vincent Pit identified change #29916 as the cause.

Once Vincent identified the problem, he was able to suggest a few ways for solving it, each with various costs and benefits. He produced a patch for 5.8, to get rid of the immediate show-stopper.

5.10/blead will require a different approach and more work.

  http://xrl.us/owaqo 

CPAN install pauses due to 'ncftp' error on cygwin (#60062)

Arthur Dunham pointed out the futility of asking ncftpget to deal with HTTP resources.

  http://xrl.us/owaqq 

op/groups.t fails when real group name contains blanks (#60136)

Altblue showed that one the core tests makes an incorrect assumption, that group names may never contain spaces. If there is one, the test fails.

  http://xrl.us/owaqs 

A number of characters match both a posix class and its complement (#60156)

Karl Williamson ran into more pre-existing errors and inconsistencies in Unicode, this time dealing with POSIX character classes. Yves Orton dashed off a patch that he expected to work and so was surprised when in fact it didn't. At the same time he sent out a personal Call For Papers for the next YAPC::Europe conference: someone ought to put a "gdb for perl hackers" session together.

  http://xrl.us/owaqu 

Perl5 Bug Summary


  279 new + 1062 open = 1341 (+11 -9)
  http://xrl.us/owaqw
  http://rt.perl.org/rt3/NoAuth/perl5/Overview.html 


New Core Modules

ExtUtils::MakeMaker 6.48
  http://xrl.us/owaqy 
SelfLoader 1.17
  http://xrl.us/owaq2 
Test::More/Simple/Builder 0.85_01
  cmp_ok() fixage warning
  http://xrl.us/owaq4 
Attribute-Handlers 0.80
  http://xrl.us/owaq6 

In Brief

David Golden began cleaning up the task of documenting Perl via git on the Perl wiki.

  http://xrl.us/owaq8 

John E. Malmberg ran into a Module::Build failure on VMS that he thought had been fixed at one point by a patch that had been dropped in the meantime. But then the test succeeded without anything else happening.

  http://xrl.us/owara 

John sent in some other patches for VMS, some of which Craig A. Berry was able to apply. One dealing with cwd issues, needs to be forwarded to the Pathtools developers (i.e. Ken Williams).

  http://xrl.us/owarc 

JCSS suggested that Storable could optionally delete %hash when doing $foo=freeze(\%hash) . Nicholas Clark pointed out that when error handling is taken into account, this becomes much more difficult than it would appear at first glance.

  http://xrl.us/oware 
  another Unix platform?
  open source BeOS!
  one puzzling bug
  http://xrl.us/owarg 

Last week's summary


  This Fortnight on perl5-porters - 28 September-12 October 2008
  http://xrl.us/owari 

About this summary

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.