Build of illumos-gate fails with perl-5.10.0 as default perl
I have a build machine, running illumos-gate and with perl-5.10.0 set as the default perl.
I ran the nightly build, with max_jobs=1 but get the following repeated error in the build log:
closedir() attempted on invalid dirhandle DIR at /export/builds/illumos/illumos-gate/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/find_elf line 303.
All code compilation steps complete successfully, and I can recover the build by going to usr/src/pkg and doing a 'make install'. I verified these manually-built packages by installing with onu and they work fine.
From irc discussion of this issue:
03:08:37 AM) richlowe: c_ellis: the opendir stuff is not at all related to packaging.
(03:08:56 AM) richlowe: c_ellis: find_elf is run as part of the "Checking ELF Runtime Attributes" bit of the build (as seen from nightly.log)
(03:09:21 AM) richlowe: c_ellis: we suspect that perl may be busted.
I downloaded the source for perl-5.10.0, performed a default configure, make, and make test, and this completes without error.
Not sure where to proceed with this one. I'll keep the build tree in case I can assist with testing.
Updated by Rich Lowe about 10 years ago
The problem is that perl IO handles are implicitly global, so when we recurse we clobber DIR, and end up closing it while it's already closed (as we ascend).
The reason it worked in 5.8.4 is, in fact, that 5.8.4 just didn't warn or error in this case:
The fix is to use perl's IO::Dir which uses IO::Handle objects, which being regular objects can be scoped.