简体   繁体   中英

Broken git add--interactive command after upgrading to Big Sur

I regularly use the interactive mode of git with: git add -p which uses the add--interactive git command.

Since I updated to Big Sur one month ago, the add--interactive command does no longer work. I get the following error:

error: git-add--interactive died of signal 11

when I run git add -p , git add -i or git add--interactive :

~/projects/gittest[master]% git add -i
error: git-add--interactive died of signal 11
~/projects/gittest[master]%

I use the system git with the system perl:

git --version
git version 2.30.1 (Apple Git-130)
perl --version
This is perl 5, version 30, subversion 2 (v5.30.2) built for darwin-thread-multi-2level

My mac version is: macOS BigSur 11.4 .

Any other git command works perfectly.

Steps I tried to fix the issue:

  • Remove gitconfig at /usr/local/etc/gitconfig
  • Remove gitconfig at `~/.gitconfig
  • Make sure, that there is no local gitconfig file
  • Use another git version installed with brew install git
  • Use another perl version installed with brew install perl
  • Reinstalled XCode developer tools

Unfortunately, nothing fixed the issue. I'm stuck and don't know how what I could try further or how I could debug it.

Does anyone knows anything about this issue? Do you have any hints what I could try to fix it?

Thanks for your help

Ok, it really seems that this perl version is broken for the git interactive script. As I already wrote in my question-post, my system-perl is:

perl --version
This is perl 5, version 30, subversion 2 (v5.30.2) built for darwin-thread-multi-2level

I first tried with the newest perl from homebrew:

`This is perl 5, version 34, subversion 0 (v5.34.0) built for darwin-thread-multi-2level``

but it failed with:

~/projects/gittest[master]% git add -i
dyld: lazy symbol binding failed: Symbol not found: _Perl_xs_apiversion_bootcheck
  Referenced from: /Users/elioschmutz/perl5/lib/perl5/darwin-thread-multi-2level/auto/List/Util/Util.bundle
  Expected in: flat namespace

dyld: Symbol not found: _Perl_xs_apiversion_bootcheck
  Referenced from: /Users/elioschmutz/perl5/lib/perl5/darwin-thread-multi-2level/auto/List/Util/Util.bundle
  Expected in: flat namespace

error: git-add--interactive died of signal 6

after installing an older version:

brew install perl@5.18 This is perl 5, version 18, subversion 4 (v5.18.4) built for darwin-thread-multi-2level

it works now fine!

Caution: the git-add--interactive script (thanks a lot to @tokek for your command-hint of using git --exec-path ) is using the perl under /usr/bin/perl . So make sure, this path points to the perl v5.18 /usr/local/opt/perl@5.18/bin/perl

Apple ships git with a hard coded expectation of perl 5.18.

I found the git-add--interactive script by running GIT_TRACE=1 git add -i . It told me that I could find the file in /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/ . Inspecting it showed this:

#!/usr/bin/env perl

# BEGIN XCODE RUNTIME_PREFIX generated code
BEGIN {
    use File::Spec;
    my $PERLVERSION = "5.18";
    if ($^V =~ m/v([0-9]+).([0-9]+)/) {
        $PERLVERSION = $1.".".$2;
    }
    my $__prefix = File::Spec->rel2abs( __FILE__ );

When they updated their main Perl binary to Perl 5.30 without updating this stuff, they broke any script that has this prefix hammered onto it.

Based on this I thought I'd try adding any missing dependencies so that they'd be available in the @INC library search directories.

I was able to get my system working by adding the Git library to the system perl:

  1. Run /usr/bin/perl -MCPAN -e shell to execute the classic interactive CPAN shell.
  2. Type install Git and wait for the build to complete with /usr/bin/make install -- OK
  3. Type q to exit the installer.

And done. These steps fixed git add -i for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM