This Week on perl5-porters - 7-13 November 2005

This Week on perl5-porters - 7-13 November 2005

This week was really, like David Landgren uses to say, a business week. Many short threads, many bug fixes, not all particularly earth-shattering, but Perl is even more solid.

Feedback from Last Week's Summary

About the sort/multicall patch, Robin Houston hushed to say that the ability to empty the array while you sort it and still retrieve the results has never worked. The point was that Robin added a test for this feature, which slipped into the patch sent to the list.

Steven Schubiger may stop assuming his patch on POD estetics was overlooked: Rafael applied it seamlessly.

See perl say() (continued)

Robin Houston argued about a possible implementation of pp_say, in a followup to last week's discussion. Rafael Garcia-Suarez made a few points and admitted himself not enthusiastic about adding a new keyword to perl, mainly a weak keyword. And things stand still in this matter.


Steve Peters hitted the undocumented behavior of print FILEHANDLE which DWIM outputting $_ to the specified filehandle. He also noticed some inconsistencies like print {STDERR} being a syntax error and B::Deparse being unprepared for this kind of expressions. Rafael Garcia-Suarez said it doesn't look easy to fix without weird side-effects.

&= and m// Misbehavior

Anno Siegel reported the bug #37616 in the last week, about a malfunction of &= operator on strings combined with some pattern match (mentioned in the previous summary). There ensued some discussion where Abigail brought the confirmation that &= is working as documented in perlop.pod, section "Bitwise String Operators". In turn, Sadahiro Tomoyuki showed how the issues with simple regexes exposed some trouble with handling NUL-terminated strings which sometimes are visible at the Perl level and sometimes are just an internals thingy. Rafael Garcia-Suarez and Nicholas Clark confessed to be bothered by such limitations, which Nicholas thought it could be a nice bug to fix and which may lead us to a nice bug fix real soon.

    The discussion of the ticket enters this week

Bad Locales in Mac OS X

On a followup to ticket #36061, Steve Peters added a change to README.macosx about yet another broken locale file, namely eu_ES (Basque-Spain). This shows up as test failures in ../lib/locale.t. Dominic Dunlop explained these test failures now are being suppressed, by skipping the offending locales, avoiding worries to perl builds on Mac OS X. Dominic also proposed a throrough update of README.macosx which was applied. With the change, Steve Peters also closed ticket #35895 which concerned this same locale.

Dying in map, grep, sort

On RT ticket #24354, Chris Heath provided a rather detailed description of how the test cases below cause attempts to free unreferenced scalars.

    perl -e 'map die,4 for 3'
    perl -e 'grep die,4 for 3'
    perl -e 'for $a (3) {@b=sort {die} 4,5}'

The bug had to do with the interaction between how map, grep, sort automatically localize certain variables and an odd behavior when unwinding context and save stacks due to an exception. Rafael Garcia-Suarez applied Chris' patch as change #26027 to bleadperl.

Behave Yourself, ucfirst

Nicholas Clark opened ticket #37628 to tell about his finding ucfirst can malform UTF-8. Nicholas' inspection of the code revealed some bad assumptions about lengths (in UTF-8) and exposed the ill-behaved code. He then noticed lcfirst had its own bug as well. And then he patched the issue(s) with change 26034 and closed the ticket, setting a model for a most productive monologue in RT.

Perl on Symbian

Jarkko Hietaniemi brought the latest of his work on the Symbian port of Perl, reaching release 0.4.0 with a lot done on the UI side (including improved support to S60 and S80 devices and UIQ).

    First patch
    Second patch

List::Util issues

DProf breaks shuffle Ticket #32383 was opened by Jarkko Hietaniemi to report problems while using DProf together with List::Util::shuffle. Even though the error message has been changing, it was still there. Robin Houston proposed a patch and was advised by Graham Barr about the use of Perl_seed which was not refactored until 5.8.1. Robin pulled together changes in Graham's svn repository more PUSH_MULTICALL changes, and after some tweaks, the patches were applied, hopefully fixing the issue.

    Rafael shows the actual message by bleadperl

Memory Leaks in first Tassilo von Parseval opened ticket #37643 to say about memory leaks in List::Util::first. Dave Mitchell remembered this issue is already fixed in blead by now.

Code Unification for Cygwin, Win32 and WinCE

Yitzchak Scott-Thoennes wondered about the forked code originally from win32/win32.c duplicated in Cygwin module Win32CORE and the status of Win32 module, core for Win32 but available for Cygwin only as part of the libwin32 distribution. Yitzchak planned to see these converging to a common code, where synchronicity will not be lost again. Jan Dubois gave a full account of the differences to be found between blead and libwin32 and noticed that the wince branch also copied some of this Win32 code.

To Jan, the starting point of this unification was the elimination of USING_WIDE codebranches that have been unused since the introduction of internal UTF8 support for PVs. And, indeed, Jan assembled a patch towards this goal of improving maintainability and the sharing with Cygwin.

Cygwin Configure

Yitzchak Scott-Thoennes and H.Merijn Brand exchanged a rather long series of messages while tighting up issues with Configure on Cygwin. In the end, it looks more stable now.

Perl on WinCE

WinCE port of Perl received a little love this week. Vadim Konovalov posted a patch to make 5.8.7 compilable for WinCE platform. H.Merijn Brand called for a patch against blead first and Vadim promised to do just that during this week. Later, he sent in the revised patch and Steve Hay explained how some issues that apply to build configuration on Win32 and AIX may be needed as well for WinCE.

DB_File 1.814

Dominic Dunlop observed which an old warning on Darwin from ext/DB_File/t/db-btree.t could go away for the recent revisions of the OS and posted a patch to do that. Paul Marquess took the change to the official DB_File with the release of 1.814 and a corresponding patch to blead.

    Dominic gets rid of old Darwin warning
    Paul Marquess announces DB_File 1.814

CPAN 1.76_65

Andreas Koenig brought up to version 1.76_65.

Time::HiRes 1.82

Jarkko Hietaniemi has had a busy time with many, many releases of Time::HiRes, eluding porters, smokes and summarizer. I guess by now Time::HiRes in blead must have reached version 1.82 as the CPAN release.

Nuking Globals and Stashes

Robin Houston remembered April 2001 when people talked about nice ways to make perl dump by nuking important globals. For example,

    perl -e 'delete $::{"@"}; warn'
    perl -e 'delete $::{"_"}; sub{}->()'

Back then, Benjamin Sugars proposed a fix still working against blead and dying to be applied. Steve Peters had a look, found the related ticket #5851, made some changes and got us rid of these core dumps.

    Benjamin Sugars' long-forgotten patch
    Robin Houston ressurects the issue
    Steve Peters closes RT ticket #5851

Perl on EBCDIC

pack('E', $arg) on perl-5.8.7 Rajarshi Das posted a notice on how pack('E', $arg) worked on EBCDIC platforms in perl-5.005_03 and it is not supported anymore on perl-5.8.7 and called for an alternative. Dave Mitchell and Sadahiro Tomoyuki observed Radarshi's perl must be a non-standard modification, since the "E" option is not present in the official 5.005_03 distribution. Rajarshi explained the 'E' is meant to turn ascii string inputs into EBCDIC results. He also agreed the extra option was locally introduced and was not available as part of the general source. Sadahiro suggested two alternative methods: one using the undocumented utf8::unicode_to_native() and other using pack('U', $arg) but warned about issues that may arise between the new UTF8 behavior and old scripts.

cond_timedwait Issues Mohammad Yaseen found some errors while playing with cond_timedwait on EBCDIC platform. Yaseen showed the issues with an extended test adapted from cond.t and hinted on possible causes.

Storable Updates

Gisle Aas posted a patch to restore Storable compatibility allowing the newer versions to read files written by Storable-0.1. Then Gisle sent in another patch with a now documented read_magic() function to decode image headers and also a file_magic() function. Steve Peters applied both patches with these new features that come handy for dealing with Storable on any platform.

    Gisle restores Storable compatibility
    Gisle brings read_magic() to the foreground

Handling Security Advisories

"Jack" opened bug #37662 to ask what address a security advisory regarding perl could be send to. H.Merijn Brand and Abigail advised to use the perl5-porters mailing list, discussing here in the open. Nicholas Clark, Dave Mitchell, and Andreas Koenig appreciated the point of keeping safe sensitive information from end-users, at least by the time necessary to fix the problem. Rafael Garcia-Suarez and Michael Cummings compared this to the infrastructure for handling security advisories by OS vendors.

Playing Games with gcc

Brendan O'Dea noticed gcc 4 no longer emits "Reading specs from ..." but rather "Using built-in specs." and posted an alternate mechanism to locate the gcc include directory. H.Merijn Brand wondered in which version of gcc the option --print-libgcc-file-name used by Brendan was introduced, for which Brendan and Abe Timmerman supplied some answers. Jason Vas Dias pointed he raised bug #37582 about this with a patch accepted as change #26074.

    Steve Peters applies Jason's patch
    Brendan's post

Perl5 Bug Summary

The open tickets count was at 1528 in Nov 7 14:00 GMT. But this had been a frantic week at bug's front: in a rough counting, perl5-porters received around 240 messages, in about 100 threads, and only Steve Peters closed at least 18 tickets. The next week should inevitably start with a lower score at the bugs count.

    Robert Spier and the Bug summary
    Perl RT just now

In Brief

Fixing gmtime Docs In RT ticket #35840, Michael Schwern reported gmtime under 5.8.6, unlike documented, returns 9 rather than 8 values. perlfunc was fixed with change #26024 by Steve Peters.

File::Glob and Its Origins On a followup to bug #37597, Steve Peters observed "there have been some changes between the Perl bsd_glob() and the original OpenBSD glob function where it came from." He'll look into merging the OpenBSD changes in soon.

perldiag issues Steve Peters closed RT tickets #3190 and #7543 about minor perldiag issues.

Redefining Sort Subs via goto Steve Peters reported on the solution of bug #7579, which concerned core dumps when redefining comparison routines via goto &NAME. After a recent change to bleadperl, the behavior we get from now on is saner. And another ticked closed.

    ./perl -wle 'sub s1 { goto &s2 } sub s2 { $a cmp $b } print sort s1 (3, 2, 1)' 
    Can't goto subroutine from a sort sub (or similar callback) at -e line 1.

A Surprising Segfault (continued) In a followup to last week's thread, Dave Mitchell added that, like Rafael Garcia-Suarez, he believed the nature of the tests being applied to various pp_* functions may be dubious, which calls for more assertions in code and better tests.

5.8.7 on AIX failing make test Sujeet Kulkarni asked for help to resolve problems while running make test on AIX. Dominic Dunlop provided some guesswork and H.Merijn Brand added a few hints regarding AIX oddities.

Panic with Multiple Encodings Steve Peters noticed the reported bug was gone with bleadperl. The above command does not panic anymore.

    perl -Ilib -Mencoding=iso-8859-1 -wle'binmode STDOUT,
        ":encoding(iso-8859-1)" or die "binmode:$!"; 
        print "\xe1", "\n";'
    "\x{128a}" does not map to iso-8859-1 at -e line 1. vs Other Long-Forgotten Patches Rafael applied a patch by Ilya Zakharevich to give more meaningful error messages from when invoked with a condition in list context. Ilya greeted the change, as he was afraid of that taking the route of tens of other patches waiting forever.

Silencing ExtUtils Tests Dominic Dunlop posted a patch to supress some leaked warnings in ExtUtils tests which was applied by Rafael Garcia-Suarez. It seemed like these tests waited long enough for Schwern's touch after behavior change of cmp_ok in Test::More.

5.6.1 Install/Compile on Solaris 8 Steve Peters urged for more information in diagnosing bug #9727. Andy Dougherty explained it had to with the output by newer gcc's, mentioned a short-term fix and confirmed perl 5.8.x handles this just fine. To Andy, it is a ticket to be closed.

Crashes in Multithreaded Server Zefram opened ticket #37652 to tell about crashes in a multithreaded server which may result in terminating or locking up the application. He posted a test program to reproduce the issue and stack traces obtained with gdb. Currently Warnocked. and $COMPILING Dan Tierra noticed the English name for $^C, namely $COMPILING, does not get exported when doing use English qw(-no_match_vars);. Steve Peters added the variable to the list of exports with change #26080.

OTHERLDFLAGS in ExtUtils::MakeMaker Steve Peters replied bug #37433 which concerns a patch to MakeMaker. Fearful of accidental breaking ExtUtils::MakeMaker, he announced the patch was sent off to queue.

PERLIO_DEBUG Patch Peter Dintelmann found that setting the environment variable PERLIO_DEBUG as described in perlapio.pod could result in segfaults and proposed a patch, applied to blead as change #26075.

binmode H, ":pop" Patch Peter 'Segfault-Killer' Dintelmann, in ticket #37557, showed how calling binmode() after popping the last IO layer results in a segfault and proposed a patch, applied as change 26101.

Andy's Const & Local Mission Andy Lester went on with his tireless mission of bringing consting and localizing goodness to Perl source code.

mathoms on VMS John E. Malmberg posted a patch to add a compile rule which is needed for VMS to compile mathoms.c. He also inquired on a few things that need to be resolved in order to allow blead to build on VMS.

Mathoms with Proper Prototypes Andy Lester noticed the mathoms functions weren't using proper prototypes, causing gcc to complain. Steve Peters applied Andy's fix as change #26099.

blead@26091 on VMS Abe Timmerman posted the results of blead snapshot @26091 on VMS. No feedback yet.

abs2rel("/foo/bar", "/foo/bar") David Golden recently reported problems in Path::Class which Ken Williams traced to an odd behavior in File::Spec: abs2rel("/foo/bar", "/foo/bar") returns the empty string rather than "." or something sensible. Before fixing it, Ken asked what are the likely issues.

Extending the stack inside ops Nicholas Clark found an apparent problem which could mean that extending the stack while inside ops would be a bad thing. Dave Mitchell explained the applicable rule, namely, it's the responsibility of the things doing the call to push a new stack. So Nicholas made the appropriate change for the case in question and called for feedback on the way he did it.

Localizing Shared Variables "dean" noticed that localizing variables bound to shared variables can cause the shared variable to become undefined and provided tests to make his point. No one answered so far.

About this summary

This summary was written by Adriano Ferreira.

Information concerning bugs referenced in this summary (as #nnnnn) may be viewed at

Information concerning patches to maint or blead referenced in this summary (as #nnnnn) may be viewed at

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 or enjoyable, please consider contributing to the Perl Foundation to help support the development of Perl.