Joshua ben Jore wrote:
The just-released EU::MM 6.56 repeats this pattern frequently:
open my($fh), '>', ...
or croak("Can't open ... for writing: $!");
...
print $fh ...; # <<< no error checking
close $fh ...; # <<< no error checking
Grepping for code:
egrep -rnH 'print '\\'$[^ ;]+ ' ExtUtils-MakeMaker-6.56
Where is EU::MM's version control? I'd like to submit a patch adding a bunch of:
or croak("Can't write '$fn': $!");
Putting in error checking at some key locations is fine, but the prospect of
adding `or die "Can't print $foo: $!"` to every print and close makes me want
to claw my eyeballs out. Its unfortunate MakeMaker can't rely on autodie and
that autodie can't override print.
Since almost nothing checks for print and close failure, and I don't blame
them its a pain in the ass, out of disk is a veritable minefield of silent
errors. Scattering error checking inside MakeMaker is sort of like checking
the ground in front of you and then merrily marching forward. Even full error
checking inside MakeMaker will still leave you to blow up somewhere else,
probably in the tests.
Fortunately there is one key location where MakeMaker does almost all its
writing to disk, ExtUtils::MakeMaker->flush. A simple patch to check that
would be lovely. If you want to write and insert a safe _print() wrapper
method and scatter that around that's fine, too.
MakeMaker's version control is listed in the META.yml and on search.cpan.org.
Does the CPAN testers code have out of disk checks? If not, before checking
each distribution it could try to write a decently sized file to the build
directory to check. If it fails, halt the build and inform the admin.
--
Stabbing you in the face for your own good.