git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git's Perl scripts can fail if user is configured for perlbrew

From
Randy J. Ray <rjray@blackperl.com>
Date
Dec 28, 2014, 22:36 UTC
Message-ID
<54A085D1.8060407@blackperl.com>

I use git on MacOS via homebrew (http://brew.sh/), and a custom Perl installation built and managed via perlbrew (http://perlbrew.pl/). At some point, commands like "git add -i" broke. I say "at some point", because I'm not a git power-user and I only just noticed it this week.

I am running Git 2.2.1 with a perlbrew'd Perl 5.20.1. When I would run 
"git add -i" (or "git add -p"), it would immediately die with a signal 
11. Some poking around showed that those git commands that are 
implemented as Perl scripts run under /usr/bin/perl, and also prefix 
some directories to the module search-path. The problem stems from the 
fact that, when you are using perlbrew, you also have the PERL5LIB 
environment variable set. The contents of it lay between the 
git-provided paths and the default contents of @INC. When the Git module 
is loaded, it (eventually) triggers a load of List::Util, whose C-level 
code fails to load because of a version mismatch; you got List::Util 
from the paths in PERL5LIB, but it doesn't match the version of perl 
from /usr/bin/perl.

After poking around and trying a few different things, I have found that using the following line in place of "#!/usr/bin/perl" solves this problem:

	#!/usr/bin/env perl
This can be done by defaulting PERL_PATH to "/usr/bin/env perl" in Makefile.

I don't know enough about the overall git ecosystem to know if this would have an adverse effect on anything else (in particular, Windows compatibility, but then Windows probably isn't having this issue in the first place).

I could just create and mail in the one-line patch for this, but I thought it might be better to open it up for some discussion first?

Randy
-- 
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray      Sunnyvale, CA      http://www.dereferenced.com
rjray@blackperl.com
twitter.com/rjray
Silicon Valley Scale Modelers: http://www.svsm.org
Next: Ævar Arnfjörð Bjarmason
Message 1 of 8 in “Git's Perl scripts can fail if user is configured for perlbrew”
  1. Randy J. RayDec 28, 2014
  2. Ævar Arnfjörð BjarmasonDec 29, 2014
  3. Randy J. RayDec 29, 2014
  4. Kang-min LiuDec 29, 2014
  5. Torsten BögershausenDec 29, 2014
  6. Randy J. RayDec 29, 2014
  7. Ævar Arnfjörð BjarmasonDec 29, 2014
  8. Ben AvelingJan 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.