This Week on perl5-porters - 10-16 February 2008

This Week on perl5-porters - 10-16 February 2008

"So should we punt in this case and revert to the old warning for SvGAMAGICAL? My personal opinion is to leave it. People doing strange things should not be surprised by strange results." -- Rick Delaney, debating the Principle of Least Surprise (or something like that).

Topics of Interest

Stratus VOS patches

Paul Green delivered his work to make perl 5.8, 5.10 and blead work on Stratus VOS. The main sticking points are a filename that begins with a '-' (minus), and filenames longer than 32 characters.

Some of the remaining test suite failures were due to VOS's slightly funky TCP stack implementation, and Paul was slightly suspicious that one of the failures indicated a problem in VOS's implementation of UDP.

Martien Verbruggen explained the finer points of POSIX's ctime behaviour to help Paul understand another failure, and that %e would be the best thing to use. Unfortunately, other so-called POSIX-compliant platforms don't implement %e, so it can't be used in perl's test suite.

Paul later listed the remaining issues on Stratus VOS and was happy to learn that in some ways VMS is even more restrictive than VOS.

  20 levels!

ext/Time/Piece/Piece.xs use of strptime

In the above process, Paul had a close look at strptime used in Time::Piece and thought it looked suspiciously identical to FreeBSD's own implementation, but it lacked the grace to acknowledge FreeBSD with a copyright.

Jerry D. Hedden demanded it be pulled from the core. People explained why this was not possible (modules check in, but they never check out) and that the module had received Larry Wall's blessing of The Right Way to do time manipulations. Other people complained that while the module was useful, the name was too cutesy by half.

Matt Sergeant owned up to being the responsible party, and said he'd reinstate the copyright, which probably was chopped in an edit by mistake.

  lost in the translation

Syntax proposal for matching balanced strings

Johan Vromans noted that 5.10 regexp enhancements had made it much easier to write regular expressions that match balanced strings, but that it would be nice to special-case the easy problems with some syntactic sugar.

Abigail found three flaws in the proposal. David Nicol thought that it would be better, on the Teach A Person to Fish principle, to provide a good tutorial to help people figure out how to write the expressions themselves.

David then suggested an alternate syntax for matching balanced strings, but no code. And I think \R already means something Unicodish.

  improved improvement proposal

Show constant in Useless use of a constant in void context

Rick Delaney mentioned that he would like to see exactly which useless constant was being used in void context, rather than the current vague error message which isn't very helpful. To show he was serious, he offered a patch that did just that. Rafael thought the idea was Good and applied the patch.

Hugo van der Sanden listed a number of edge cases where this could lead to trouble, but Rafael thought that people who triggered the edge cases should probably know why they were triggering them, and Rick agreed.

  the error message is the Truth

Change 33302 breaks my Win32 build

Steve Hay noticed that change #33302 was falling over on Win32, with even miniperl crashing. The problem was in pp_hot.c, where an equality against cLISTOP->op_last->op_type was broken, because op_last, while not NULL, was pointing out the window. Sven Dowideit reported similar problems on Solaris.

Change 33313 causing failures

Jerry D. Hedden reported a new failure in t/op/pat.t that manifested itself when run with TEST, but not in the harness. Much discussion followed regarding how the TAP parser deals with garbage.

The failure in t/op/pat.t was resolved to most people's satisfaction. The underlying problem was a typo: $ = ~/.../ rather than $ =~ /.../ and there was a bit of discussion about why that returns the complement of 0.

DTrace probes for bleadperl part 2

Sven Dowideit tried added more DTrace probes to perl, notably to track SV allocations, and module loads but was still having trouble with getting op.c to cooperate.

Shell patterns are subject to tilde expansion

Nicholas Clark discovered a latent bug in Configure that would manifest itself on a machine without a csh C shell installed. He was rather surprised to trace the origin of the bug all the way back to Perl 1, and defied anyone to find a more ancient bug.

Given the crappiness of csh, the true miracle is that no-one discovered this bug sooner.

Slowdown of sort keys %hash under use locale

Marcus Holland-Moritz noticed that use locale prevented a hot C routine from being cached during a sort of hash keys, and suggested a simple solution, although he was uncertain whether it could break code out in the wild.

Rafael thought the patch looked fine, and suggested that if a bug did indeed emerge afterwards, it would probably be due to the magic handling code (and so the fix would be made there).

  cache dispenser

Bug or feature in B::class()

Jim Cromie wondered why

  my $start = B::main_start();

produced a Can't locate object method error message. Eirik Berg Hanssen explained why and suggested an alternate syntax that would do want Jim wanted. Joshua ben Jore said that it was that way because no-one had bothered to implement it.

  if you build it

Testing B

Jim Cromie said that a full test suite for the B modules would be a great idea. In the process of improving B::Generate, he had begun made a good start on doing just that. He posted his current work in progress and asked if there was interest in having it in blead.

Michael G. Schwern made some very good suggestions on how to better leverage the testing infrastructure to make Jim's work easier and improve the quality of the diagnostics when things break.

  Jimmy B Goode

Assistance with IPC modules and perl 5.10

Tom Callaway wrote to say that he was preparing perl 5.10 for inclusion in the upcoming Fedora 9 release, and was having troubles with IPC::ShareLite and IPC::SharedCache. This was holding up the process and time was running out, which meant he'd have to go with 5.8.

That these two particular modules were deemed to be on the critical path puzzled a number of the porters who had either never heard of them or had only a vague idea what purpose they served. A careful examination of the failures indicated that these two modules were in fact optional, and weren't sufficient reason to block the Fedora release.

Nevertheless, Tom wanted to know if and how they could be fixed. The concensus was that it was a 32/64 bit issue rearing its ugly head.

Dave Rolsky was of the opinion that these two modules sucked so much that no-one in their right mind should be using them.

  memcached, memcached, memcached

Patches of Interest

PERL_MAGIC_uvar_elem should be 'u' in dump.c

Vincent Pit discovered an inconsistency between the magic type uvar_elem and its symbolic name. He also wondered whether it was even used any more. Rafael applied the fix and mentioned that DBI and/or Tk use it.

Is IPC/SysV/SysV.xs compiling?

Marcus Holland-Moritz wanted to know if Steve Peters and Jarkko Hietaniemi were still seeing black smoke compiling this module. If not, this would allow him to proceed in the release of a new version.

use svtype

Robin Barker straightened out the declaration of sv_type as an svtype instead of the current mish-mash of I32 and U32 types, and added a sprinkle of consting goodness into the mix. Applied by Rafael.

doio.c Perl_my_lstat revisited

Vincent Pit had a look at the implementation of my_lstat and discovered that magic was called two times too many and could generate a slew of superfluous warnings with -l undef. He corrected that and also fixed a test that was passing when it shouldn't. Steve Peters thought the change looked good enough and applied it.

Splitting OP_CONST

Vincent took Nicholas Clark at his word (from the pp_const, not, that, hot thread) and split OP_CONST into two separate ops. He had it running correctly on both threaded and non-threaded builds, although no-one picked it up to apply it to blead.

  what's a semaphore

Updating Thread::Semaphore and Thread::Queue

Jerry D. Hedden cast his net wider in the threads infrastructure and spent some time working with Thread::Semaphore. After a couple of false starts and doing battle with Test::More on 5.8.0, he was able to release version 2.04, which Rafael applied to blead.

Once that was out of the way, Jerry took a look at Thread::Queue and added some useful functionality and a whole pile of tests.

Jerry discovered that Thread::Semaphore will barf on non-numeric parameters, but will happily accept $sem->up(0.5) or $sem->down(-1). Whilst these could be construed as being a semaphore that can't make up its mind and a semaphore being raised, respectively, Jerry was inclined to classify them as errors as well.

If no-one voices objections soon, that's probably what such shenanigans will become.

Don't install threads files on non-threaded Perls

H.Merijn Brand thought that all the threads files that were installed on a non-threaded build were pretty pointless, untidy and/or a waste of space. So Jerry D. Hedden patched the installer to prevent that from happening. Rafael Garcia-Suarez applied it, and H.Merijn rejoiced.

Then he discovered another set of thready files and wondered if they could be axed as well.

New and old bugs from RT

More adventures on IRIX (#33849)

David Cantrell announced that he had warmed up his IRIX iron, and had taken the previous suggestions and fixes out for a spin. He reported that the compilation had proceeded somewhat further, but still wound up crashing and burning.

Andy Dougherty, unfazed by such minor trivialities, moved onto Plan B, which involves using make minitest, to run a health check on miniperl. He warned that there may many spurious errors due to tests relying on modules that have not yet been built but nevertheless may provide some clues to what is going wrong.

Andy's Plan C would be to compile without -O3 optimisation (his initial suspicion being that the C compiler optimiser is getting confused). Were David feeling particularly brave, he could pin-point the offending file by compiling files with personalised optimisation settings, and the resulting knowledge gleaned from the exercise could be safely stowed away in the IRIX hints file.

Nicholas suggested David investigate ccache if he was serious about trying this last approach.

  the real question is, how many people still use IRIX?

Use of inherited AUTOLOAD for non-method is deprecated (#47047)

Rick Delaney revived a dead bug that had slipped through the cracks in the run-up to 5.10. Steve Peters applied it, and Rafael Garcia-Suarez hastily unapplied it, since a minor detail that Rick overlooked in the implementation caused segfaults on other platforms.

Rafael explained that the ultimate correct fix would add a lot of make-work code and wasn't sure that the cost was worth it. Rick concurred.

%^H affecting outside file scopes (#50706)

Rick Delaney discovered that %^H hints could leak across file scopes and thought that this wasn't right. He then created a small patch that he thought should fix the problem. Rafael believed that Rick was right, so he applied it.

goto error? (#50742)

You cannot goto a subroutine declaration. This is by design.

Bug fix in malloc.c (#50856)

Mark Noyes patched the perl memory management helper routine getpages_adjacent to work around a bug that manifests itself on Solaris with 5.6.1 and 5.8.8. No reports as to whether this is (still)? a problem in 5.10 or blead.

Perl5 Bug Summary

  287 new + 1498 open = 1785 (Created: 6, Closed: 5)

In Brief

Paul Marquess thanked Jan Dubois for spotting an omitted change to DB_File. He explained that the impact was purely cosmetic and would do something about it the next time something major was scheduled.

Rafael Garcia-Suarez applied Jerry D. Hedden's read-only variable tests from last week.

Jerry also found an unused variable in perlio.c and Rafael applied that as well.

  less bloat

Jerry then needed help with a threads::shared code issue that works on blead but warns on maint. Rafael solved it neatly by pointing out that the code in question would never be backported to maint since the change is technically a change in the API. And thus it could be wrapped up in #ifdefs.

Nicholas Clark isolated an interesting self contained task dealing with replacing two ops by one op, that would be a nice introduction for someone wanting to get their hands dirty working on the internals.

Philippe Bruhat expressed interest, but then Nicholas spoiled the fun by discovering that a one-character patch to solved the problem nicely.

  the art is knowing which one character to add

Robin Barker saw that the last run of make regen_header tweaked pod/perlapi.pod and posted the changes in a patch. Unapplied.

  why is this not automatic?

Abigail also thought that her TODO tests for issues relating to keys %+ does not return the correct keys (bug #50496) had been ignored. Rafael replied that one of the non-TODO tests was also failing, so he TODOified it as well, and applied it all in change #33313.

Abigail also tweaked perlfunc.pod regarding "%+d" (plus) sprintf format specifiers. Accepted by Rafael.

Vincent Pit ran into some Unbalanced string table refcount errors on a non-threaded blead, that Rafael fixed with change #33322.

  you just have to ask

Daniel Frederick Crisman wrapped up the no link label on CPAN html debate by suggesting that the finer points of POD are best discussed on the pod-people mailing list.

Michael Schroeder asked whether Yves had been able to look at "0"x51)=~/0{50}/ causing a panic on PPC bug (#50114).

  lost IRL

In a similar vein, Jan Dubois wondered if his fix for bit-fields for VC that would solve bug #50386 had been Warnocked.

Steve Hat noticed that change #33292 to bitfields caused compiler warnings on Win32/VC6. He and Jan discussed the problem, which was caused by different types (ints and chars) being used in bit-fields. Steve cleaned everything up with change #33315.

About this summary

  3-10 February 2008

This summary was written by David Landgren. The in-laws are in town, so this week's summary has even less error checking than usual. Please forgive me if there are even more typos and wordos than usual.

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.