Mailing List Archive

NWCLARK TPF grant report #42
[Hours] [Activity]
2012/06/18 Monday
3.00 Class::Struct
0.25 Config::Perl::V
3.25 File::stat
0.25 IO::Socket::IP
0.50 smoke-me/cmpVERSION
3.25 t/op/arith.t
1.25 t/op/arith.t tryeq_sloppy

2012/06/19 Tuesday
2.75 Config::Perl::V
2.25 File::stat
0.25 RT #113620
0.25 applying patches (with massaging)
0.25 perldelta updates
0.75 smoke-me branches

2012/06/20 Wednesday
1.25 reading/responding to list mail
0.25 regexp set syntax
2.00 smoker logs
0.25 t/op/arith.t

2012/06/21 Thursday
0.25 File::stat
1.25 lib/locale.t
3.25 t/re/reg_posixcc.t

2012/06/22 Friday
0.25 reading/responding to list mail

2012/06/23 Saturday
3.50 smoke-me/require

Which I calculate is 30.50 hours

I fixed a long-standing bug in File::stat's handling of -x and -X for
directories and executable files when running as root.

Previously File::stat's overloaded -x and -X operators gave the correct
results only for regular files when running as root. However, they had been
treating executable permissions for root just like for any other user,
performing group membership tests etc. for files not owned by root. They now
follow the correct Unix behaviour - for a directory they are always true,
and for a file if any of the three execute permission bits are set then they
report that root can execute the file. Perl's builtin -x and -X operators,
added in Perl 2, have always been correct.

Thinking I was home and dry, I pushed a smoke-me branch to the repository
(including the previous week's changes) and waited for the testers on
various platforms to check it out and report back. Result - *nearly*
everything worked, except for a mysterious failure on OS X. So I tried the
test on OS X locally, and obviously I can't replicate the failure. Which
resulted in a careful scouring of the smoker logs (exactly which test did
fail?), trying to replicate the problem on various other operating systems
(no success), and eventually realising that the problem was a combination of
two things. Firstly that darwin defaults mounts to POSIXly-correct atime
semantics - atime is always updated when a file is read. Secondly, when
tests run in parallel, the atime of $^X will update whenever another perl
process starts. The result is a race condition between the stat calls in
this test, and any other test that runs. Life is always fun when reads
trigger write actions - and it doesn't just happen with perl's scalar types.

It also turned out that my refactoring of the test exposed a latent bug
present in it, which I failed to spot. Fortunately Father Chrysostomos
diagnosed that the test was always using stat(), even when testing -l, and
fixed it to use lstat() in that case.

I spotted some code in Class::Struct related to 5.002 and 5.003
compatibility. Obviously that's long dead, so it should come out, and this
will be a nice quick one-hit tidy up. Of course, the world doesn't work like
this. The code in question affects an error message, and it turns out that
there are no tests for any of the error conditions in Class::Struct. It felt
wrong to add just one test for the error check whose code I was refactoring,
leaving all the rest naked, so the simple fix acquired a not-so-simple
pre-requisite. And then that turned out to reveal another hole in the
testing - initialiser lists had insufficient tests. So, before testing the
error paths in initialiser lists, we probably should test the success paths.
And so some time later, I removed (net) 5 lines of dead code. Collateral
damage - 69 regression tests, where previously there were only 26.

Config::Perl::V is a module written by H. Merijn Brand to provide structured
access to the output of perl -V, used by most of the CPAN testing
infrastructure. The reason that it exists is that historically some
configuration information about the running perl had only been available in
the output from running perl -V. This gets "interesting" if the running perl
program wants the values, as not only does one have to parse the output
robustly and cope with the obscure case, but in the general case re-running
the correct perl interpreter binary is not a trivial task - possibly it's
not installed so library paths need overriding, or possibly not the first
perl in the PATH. The module abstracts all this away nicely.

The plan is to add it to the core distribution, because it simplifies the
CPAN toolchain to have it always available. However, the "historically"
above is pertinent - the implementation of Config::Perl::V predates changes
I made for 5.14.0, which has functions in the Config module which expose to
Perl space all the information previously only available by running perl -V.
Hence I spent some time updating Config::Perl::V to use the routines in
Config where available, and adding a test that cross checks that the old and
new approaches give the same answers.

This week also saw the start of the of the investigation which lead to the
various bugs now fixed on the smoke-me/require. At the time, it wasn't
clear how serious they were, or what their implications were.

Nicholas Clark