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 <[email protected]>


--- 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) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to