From: Stephen Hemminger <stephen@networkplumber.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 4/4] get_maintainer: use anonymous function instead of eval
Date: Mon, 26 May 2014 13:33:13 -0700 [thread overview]
Message-ID: <20140526203358.050994577@networkplumber.org> (raw)
In-Reply-To: 20140526203309.782169359@networkplumber.org
[-- Attachment #1: get_maintainer_lambda.patch --]
[-- Type: text/plain, Size: 1354 bytes --]
Change get_maintainer to use anonymous function instead of eval().
Using a anonymous function is safer than doing eval on a string.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/scripts/get_maintainer.pl 2014-05-26 13:23:00.480939284 -0700
+++ b/scripts/get_maintainer.pl 2014-05-26 13:23:45.925291872 -0700
@@ -93,8 +93,9 @@ my $rfc822_char = '[\\000-\\377]';
my %VCS_cmds_git = (
name => 'git',
execute_cmd => \&git_execute_cmd,
- available => '(which("git") ne "") && (-e ".git")',
-
+ available => sub {
+ return (which("git") ne "") && (-e ".git");
+ },
find_signers_cmd =>
"git log --no-color --follow --since=\$email_git_since "
. '--numstat --no-merges '
@@ -129,7 +130,9 @@ my %VCS_cmds_git = (
my %VCS_cmds_hg = (
name => 'hg',
execute_cmd => \&hg_execute_cmd,
- available => '(which("hg") ne "" ) && ( -d ".hg" )',
+ available => sub {
+ return (which("hg") ne "" ) && ( -d ".hg" );
+ },
find_signers_cmd => "hg log --date=\$email_hg_since "
. "--template='HgCommit: {node}\\n"
. "HgAuthor: {author}\\n"
@@ -1401,7 +1404,7 @@ sub vcs_blame {
my $printed_novcs = 0;
sub vcs_exists {
foreach my $vc (@VCS_avail) {
- return $vc if eval $vc->{available};
+ return $vc if $vc->{available}();
}
if (!$printed_novcs) {
next prev parent reply other threads:[~2014-05-26 20:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 20:33 [PATCH 0/4] get_maintainer script cleanups Stephen Hemminger
2014-05-26 20:33 ` [PATCH 1/4] get_maintainer: use three argument open Stephen Hemminger
2014-05-26 20:33 ` [PATCH 2/4] get_maintainer: remove quoting on hash label Stephen Hemminger
2014-05-26 20:33 ` [PATCH 3/4] get_maintainer: use array for defining available version control Stephen Hemminger
2014-05-26 20:33 ` Stephen Hemminger [this message]
2014-05-27 1:00 ` [PATCH 0/4] get_maintainer script cleanups Joe Perches
2014-05-27 1:03 ` Joe Perches
2014-05-27 1:09 ` Stephen Hemminger
2014-05-27 1:22 ` [PATCH 5/4] get_maintainer: shut up perl critic Stephen Hemminger
2014-05-27 1:32 ` Joe Perches
2014-05-27 17:00 ` Stephen Hemminger
2014-05-27 1:06 ` [PATCH 0/4] get_maintainer script cleanups Stephen Hemminger
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=20140526203358.050994577@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox