Re: [PATCHv2] gitweb: gravatar support
From: Aaron Crane <hidden>
Date: 2016-06-15 22:46:58
Giuseppe Bilotta writes:
+# check if gravatars are enabled and dependencies are satisfied
+our $git_gravatar_enabled = gitweb_check_feature('gravatar') &&
+ (eval { use Digest::MD5 qw(md5_hex); 1; });
This test for the availability of Digest::MD5 is broken: `use`
statements are executed at compile time, so the whole program will
fail if Digest::MD5 can't be loaded.
A possible fix would be to move the compile-time actions to run time:
our $git_gravatar_enabled = gitweb_check_feature('gravatar') &&
(eval { require Digest::MD5; Digest::MD5->import('md5_hex'); 1 });
However, I don't recommend doing that. Digest::MD5 is a core module
in Perl 5.8.0 and later, so an installation of Perl 5.8 that doesn't
have it is broken. Since gitweb.perl already needs 5.8 (because of
the `binmode STDOUT, ':utf8'` at the top, if nothing else) I see no
value in jumping through hoops to make this work in the essentially
impossible situation where Digest::MD5 is unavailable.
--
Aaron Crane ** http://aaroncrane.co.uk/