From: Jakub Narebski <jnareb@gmail.com>
To: Aaron Crane <git@aaroncrane.co.uk>
Cc: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCHv2] gitweb: gravatar support
Date: Sat, 20 Jun 2009 18:58:56 +0200 [thread overview]
Message-ID: <200906201858.57346.jnareb@gmail.com> (raw)
In-Reply-To: <20090620141626.GK7675@aaroncrane.co.uk>
On Sat, 20 June 2009, Aaron Crane wrote:
> 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 });
>
Good catch!!! But we don't need import if we are to use slightly longer
form: Digest::MD5::md5_hex.
> 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.
In this case the problem is not with Digest::MD5 not being installed.
The problem is with not loading this module in a CGI script if it is
not required (i.e. problem is not dependencies but performance).
BTW. we sometimes unnecessary calculate MD5 hash repeatedly for the
same author / committer in log-like views... but I don't see how to
solve it in an easy way.
--
Jakub Narebski
Poland
prev parent reply other threads:[~2009-06-20 16:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-19 18:21 [PATCHv2] gitweb: gravatar support Giuseppe Bilotta
2009-06-19 18:26 ` Johannes Schindelin
2009-06-19 18:36 ` Johannes Schindelin
2009-06-19 20:28 ` Junio C Hamano
2009-06-19 22:43 ` Giuseppe Bilotta
2009-06-20 19:24 ` Jakub Narebski
2009-06-20 10:57 ` Jakub Narebski
2009-06-20 14:16 ` Aaron Crane
2009-06-20 16:58 ` Jakub Narebski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906201858.57346.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@aaroncrane.co.uk \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=giuseppe.bilotta@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.