This Week on perl5-porters - 18-24 September 2006

This Week on perl5-porters - 18-24 September 2006

If we fake times in our fake stat then fake futimes makes sense. But chown and chmod make little sense to me - only the current process can access the scalar so current UID is owner (and can't exec it).

We could accept the calls and set errno to nearest code that made sense, or perhaps just set the mode so that fake stat saw it.

Have we missed any more fd related calls? If there anything else that we can do to filehandles via perl interface that we missed?

-- Nick Ing-Simmons, discussing how to improve PerlIO::Scalar, September 1st, 2006.

Topics of Interest

Shrinking the context struct

Nicholas Clark noticed a sly new technique to fiddle around with unions of structs used for dealing with contexts, which would result in some memory savings that had the added bonus of bringing the size of the structure down to 64 bytes in the ILP32 data model.

(ILP32 means that integers, longs and pointers are all 32-bit data types).

So Nicholas applied the change, and then stepped gingerly back from the keyboard to see what the smoke machines would make of it.

A roadmap for MakeMaker developments

Michael G. Schwern posted his thoughts on what needs to be done to get a new stable version out the door, as well as future directions, which includes the desire for a major rewrite of the documentation.

The list appeared to be furious agreement.

__attribute__format__(__printf__... in BSD land

Philip M. Gollucci was having great difficulty in figuring out why gcc on FreeBSD was stumbling over an __attribute__ attribute to the printf C declaration, and declared it to be a show-stopper for 5.10, since it breaks mod_perl2.

He also supplied the current crop of compiler warnings when compiling blead.


Andy Lester wrote up a report on Klocwork, a source code analysis tool, comparing it to Coverity, another tool that does the same sort of work. Jonathon Rockway appeared interested in following up on the issues uncovered.

sort and 0 returns from comparison routines

Allen Smith posed a most interesting question about sorts, in relation to genetics, whereby it may be cheap to compare (and thus order) X and Y, and is comparing Y and Z. But comparing X and Z may be inconveniently expensive. So he wanted to know if there was a sort algorithm that allowed one to punt the decision (for instance, by returning undef), and force the algorithm to use different comparisons to arrive at a sorted order.

John P. Linderman thought that what Allen really needed was not a relational sort, but a topological sort, and suggested taking a look at Sort::Topological.


C++ status report

Jarkko Hietaniemi posted his latest patchwork to get the perl distribution comping with C++. The two remaining modules that still cause problems are Compress::Zlib and Digest::SHA.

Part of the problem with Compress::Zlib is that it is possibly even more widely used than Perl, and its authors are understandably loathe to give up K&R function signatures. And it seems the only way to have both K&R and ANSI signatures is to use horrible #if/#else botches.

Patches of Interest

Teach regex optimiser how to handle (?=) and (?<=) properly.

Yves Orton taught us a little more about how he taught the regexp optimiser to make use of the information available in zero-width lookahead (and lookbehind) assertions.

Patch for win32.c to fix #38723 and #39531

Andrew Savige and Yves continued to beat this patch into shape.

Exporter documentation

Gabor Szabo suggested adding use strict/use warnings/use base into the documentation for Exporter. It seemed to rub a number of people the wrong way.

New and old bugs from RT

XSUB.h version check may fail due to locale (#37714)

John Peacock supplied a patch to fix this problem in blead, and promised a new version of version soon.

-M isn't forbidden on the #! line with -x (#38488)

Rafael thought that it would be difficult to resolve this problem in a sufficiently robust way, mainly because of whitespace issues on the command line.

PL_compiling.cop_warnings changed structure in 5.8.8? (#40352)

This was a false alarm that Nicholas Clark figured out was because the code in question was based an incorrect assumption about what pointer to use.

getppid.t fails, all others tests pass (#40362)

pjm at sanger reported a problem on a Tru64 platform with a test for the parent pid not working correctly. No takers for the moment.

  millions and millions of pids

Nested for loops: only internal loop is executed (#40365)

Posting a broken program to a bug-tracker...


File::Find mishandles non-dangling symlinks (#40369)

Ammon spotted a bug in File::Find's code, that has probably existed forever, and fixed it. Steve Peters applied the change.

h2xs enum bug in ExtUtils::Constant::WriteConstants (#40381)

Aaron Dancygier hit a problem with enums created with h2xs. Steve Peters thought that the bug had possibly been fixed since, and asked for a test case. Aaron supplied a tarball.

  Tune in next week

threads: deadlock occurred on creation of a thread while joining others (#40382)

Tsutomu Ikegami demonstrated how to produce thread deadlocks (threadlocks?) more or less on demand, and noted that blead was better but not perfect. Jerry D. Hedden, having spent an inordinate amount of time on this issue in the recent past wanted to know if the fault was still observed when using the latest version (v1.42) of the threads module. When he tried, everything went swimmingly.

Unexpected empty captured match vars after match (#40384)

Alex Davies demonstrated a bug that exposed some borderline behaviour with failing s///g matches and capture variables. Dave Mitchell noted that the test suite didn't exercise this problem, and wasn't even sure what the correct behaviour should be anyway.

  And if Dave's not sure...

perl_destruct() leaks PL_main_cv (#40388) and perl_destruct() leaks PL_defstash (#40389)

Gozer demonstrated two ways to produce leaks, but Andy Dougherty was unable to recreate them with a fresh copy of blead, and asked Gozer to check and see whether he still saw the same problems with that.

  The dynamic duo

%SIG isn't cleared during perl_shutdown() (#40390)

Gozer also went on to show that a signal handler may still be registered during perl_shutdown even though the data structures for them have been freed. If a signal arrives after this has occurred, bad things happen.

PerlIO::encoding doesn't handle fallback modes correctly? (#40401)

Steve Hay was trying to bend PerlIO::encoding to do his bidding, but was not having much luck.

Compiling jpl/PerlInterpreter fails (#40403)

Sakina Suliman was having trouble building the JPL interpreter.

  I guess that's why we pulled it

jpl/Test failing to run (#40404)

Sakina then managed to get JPL to run anyway, but then ran into grief a little further on.

  The last JPL user on earth

undef and seek on filehandles opened to references causes segfaults (#40407)

"buu" discovered that if you open a filehandle to an in-memory scalar, and then undef the scalar, perl will segfault. While this is probably a silly thing to do at the best of times, a segfault is perhaps a tad severe to indicate that it's wrong.

Perl5 Bug Summary

  One less than last week

  Get 'em while they're hot

In Brief

The SIGSEGV, SIGBUS and SIGILL signals are now delivered unsafely, paradoxically, for added safety.

David Landgren followed up on a problem posted by Xho Jingleheimerschmidt, whereby running the same program under taint mode doubled the amount of memory used. It turned out to be a problem to do with using the x repetition operator on a list, rather than a scalar. Thus, the fix was easy, but the reason remains unknown.

The Mac OS/X / SpamAssassin problem continued to roll along with Dominic Dunlop trying to get a handle on the problem. Alas, without success.

Yuval Kogman got caught out by the interpolation of scalar references in a string and wondered if it was a bug or a feature. It is, of course, a feature, and perlref was amended to clarify the fact.

Sebastian Steinlechner spotted a problem with the ordering of variable declarations in IO::Socket and got things straightened out.

Filip Filipov wanted to know how to write Storable data files in Java, so that Perl could read them. Yuval Kogman thought that it would be easier to use YAML or something else. Storable is tied too intimately to Perl's internals to be used easily as an interchange format.

The way perl allocates more memory than immediately (with an eye to reducing the amount of subsequent reallocations required) was tweaked slightly for 5.8.8. It turns out that this caused a problem in DBD::ODBC. But knowing the cause of the problem is half way to figuring out the solution.

The optimisations that Nicholas Clark introduced into inlined constant subroutines a while back caused new warnings to emerge in File::Slurp's test suite. But since the code in question is somewhat questionable, Nicholas felt that it was working as advertised.

  Doctor, it hurts when I do this

Yves Orton and Nicholas Clark continued to kick around the idea of a pluggable regexp engine. Stay tuned for more information next week.

Adriano Ferreira added test descriptions to lib/File/Copy.t,

About this summary

This summary was written by David Landgren. According to my records, last week's summary rolled the total words written past the 100 000 words threshold.

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.