git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv2] gitweb: gravatar support

From
ACAaron Crane <git@aaroncrane.co.uk>
Date
Jun 20, 2009, 14:16 UTC
Message-ID
<20090620141626.GK7675@aaroncrane.co.uk>
In-Reply-To
<1245435670-5688-1-git-send-email-giuseppe.bilotta@gmail.com>
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/
Previous: Jakub NarebskiNext: Jakub Narebski
Message 8 of 9 in “[PATCHv2] gitweb: gravatar support”
  1. Giuseppe BilottaJun 19, 2009
  2. Johannes SchindelinJun 19, 2009
  3. Johannes SchindelinJun 19, 2009
  4. Junio C HamanoJun 19, 2009
  5. Giuseppe BilottaJun 19, 2009
  6. Jakub NarebskiJun 20, 2009
  7. Jakub NarebskiJun 20, 2009
  8. Aaron CraneJun 20, 2009
  9. Jakub NarebskiJun 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.