Skip to content

mingw: prevent external PERL5LIB from interfering

Johannes Schindelin via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4config: rename `dummy` parameter to `cb` in git_default_config()config.c+2 -20 replies
2/4Allow for platform-specific core.* config settingscompat/mingw.c compat/mingw.h config.c +1 more+19 -30 replies
3/4Move Windows-specific config settings into compat/mingw.ccache.h compat/mingw.c config.c +1 more+18 -170 replies
4/4mingw: unset PERL5LIB by defaultDocumentation/config.txt compat/mingw.c t/t0029-core-unsetenvvars.sh+70 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] mingw: prevent external PERL5LIB from interfering

In Git for Windows, we do not support running the Perl scripts with any random Perl interpreter. Instead, we insist on using the shipped one (except for MinGit, where we do not even ship the Perl scripts, to save on space).

However, if Git is called from, say, a Perl script running in a different Perl interpreter with appropriately configured PERL5LIB, it messes with Git's ability to run its Perl scripts.

For that reason, we devised the presented method of defining a list of environment variables (via core.unsetEnvVars) that would then be unset before spawning any process, defaulting to PERL5LIB.

An alternative approach which was rejected at the time (because it interfered with the then-ongoing work to compile Git for Windows using MS Visual C++) would patch the make_environment_block() function to skip the specified environment variables before handing down the environment block to the spawned process. Currently it would interfere with the mingw-utf-8-env patch series I sent earlier today
[https://public-inbox.org/git/[email protected]].

While at it, this patch series also cleans up house and moves the Windows-specific core.* variable handling to compat/mingw.c rather than cluttering environment.c and config.c with things that e.g. developers on Linux do not want to care about.

Johannes Schindelin (4):
config: rename dummy parameter to cb in git_default_config() Allow for platform-specific core.* config settings Move Windows-specific config settings into compat/mingw.c
mingw: unset PERL5LIB by default

 Documentation/config.txt     |  6 ++++
 cache.h                      |  8 -----
 compat/mingw.c               | 58 +++++++++++++++++++++++++++++++++++-
 compat/mingw.h               |  3 ++
 config.c                     | 18 ++++-------
 environment.c                |  1 -
 git-compat-util.h            |  8 +++++
 t/t0029-core-unsetenvvars.sh | 30 +++++++++++++++++++
 8 files changed, 109 insertions(+), 23 deletions(-)
 create mode 100755 t/t0029-core-unsetenvvars.sh

base-commit: 4ede3d42dfb57f9a41ac96a1f216c62eb7566cc2
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-62%2Fdscho%2Fperl5lib-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-62/dscho/perl5lib-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/62

Signature · 1 line
gitgitgadget