patches: minor formatting updates
[git-osx-installer.git] / patches / km / no-perl-vars.txt
blob47f2cd06706fa717fc7140ebc10596110de920ca
1 Subject: [PATCH] run-command.c: unset troublesome PERL env vars
3 Unset troublesome PERL environment variables before exec'ing
4 a sub-process.  In particular, PERL5LIB, PERLLIB, PERL5OPT and
5 PERLIO are unset.  This avoids, for example, having a PERL5LIB
6 variable set to libraries that would override and be incompatible
7 with the version of Perl the Git perl-based utilities were built
8 to use.
10 But don't do this if we're running the git svn subcommand as it
11 uses the perl found in the current PATH rather than the compile-
12 time perl.
14 Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
16 ---
17  run-command.c | 7 +++++++
18  1 file changed, 7 insertions(+)
20 diff --git a/run-command.c b/run-command.c
21 index aad03ab7..cb99bbfd 100644
22 --- a/run-command.c
23 +++ b/run-command.c
24 @@ -416,6 +416,13 @@ fail_pipe:
25                                         unsetenv(*cmd->env);
26                         }
27                 }
28 +               if (cmd->git_cmd || cmd->use_shell || !cmd->argv ||
29 +                   !cmd->argv[0] || strcmp(cmd->argv[0], "git-svn")) {
30 +                       unsetenv("PERL5LIB");
31 +                       unsetenv("PERLLIB");
32 +                       unsetenv("PERL5OPT");
33 +                       unsetenv("PERLIO");
34 +               }
35                 if (cmd->git_cmd)
36                         execv_git_cmd(cmd->argv);
37                 else if (cmd->use_shell)
38 ---