简体   繁体   English

升级到 Big Sur 后损坏的 git add--interactive 命令

[英]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.我经常使用 git 的交互模式: git add -p它使用add--interactive git 命令。

Since I updated to Big Sur one month ago, the add--interactive command does no longer work.自从我一个月前更新到 Big Sur 以来, add--interactive命令不再起作用。 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 :当我运行git add -pgit add -igit 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 和系统 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 .我的 mac 版本是: macOS BigSur 11.4

Any other git command works perfectly.任何其他 git 命令都可以完美运行。

Steps I tried to fix the issue:我试图解决问题的步骤:

  • Remove gitconfig at /usr/local/etc/gitconfig删除gitconfig/usr/local/etc/gitconfig
  • Remove gitconfig at `~/.gitconfig删除gitconfig在`〜/的.gitconfig
  • Make sure, that there is no local gitconfig file确保没有本地gitconfig文件
  • Use another git version installed with brew install git使用brew install git安装的另一个 git 版本
  • Use another perl version installed with brew install perl使用通过brew install perl安装的另一个 perl 版本
  • Reinstalled XCode developer tools重新安装 XCode 开发人员工具

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.好吧,看来这个 perl 版本对于 git 交互式脚本来说真的是坏掉了。 As I already wrote in my question-post, my system-perl is:正如我在我的问题帖子中已经写的那样,我的 system-perl 是:

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:我首先尝试使用自制软件的最新 perl:

`This is perl 5, version 34, subversion 0 (v5.34.0) built for darwin-thread-multi-2level`` `这是为 darwin-thread-multi-2level 构建的 perl 5, version 34, subversion 0 (v5.34.0)``

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 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 .注意: git-add--interactive脚本(非常感谢@tokek 提供使用git --exec-path命令提示)正在使用/usr/bin/perl So make sure, this path points to the perl v5.18 /usr/local/opt/perl@5.18/bin/perl所以确保,这个路径指向 perl v5.18 /usr/local/opt/perl@5.18/bin/perl

Apple ships git with a hard coded expectation of perl 5.18. Apple 发布的 git 具有 perl 5.18 的硬编码期望。

I found the git-add--interactive script by running GIT_TRACE=1 git add -i .我通过运行GIT_TRACE=1 git add -i找到了git-add--interactive脚本。 It told me that I could find the file in /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/ .它告诉我可以在/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.当他们将他们的主要 Perl 二进制文件更新到 Perl 5.30 而没有更新这些东西时,他们破坏了任何带有这个前缀的脚本。

Based on this I thought I'd try adding any missing dependencies so that they'd be available in the @INC library search directories.基于此,我想我会尝试添加任何缺少的依赖项,以便它们在@INC库搜索目录中可用。

I was able to get my system working by adding the Git library to the system perl:通过将 Git 库添加到系统 perl,我能够让我的系统正常工作:

  1. Run /usr/bin/perl -MCPAN -e shell to execute the classic interactive CPAN shell.运行/usr/bin/perl -MCPAN -e shell来执行经典的交互式 CPAN shell。
  2. Type install Git and wait for the build to complete with /usr/bin/make install -- OK输入install Git并等待构建完成/usr/bin/make install -- OK
  3. Type q to exit the installer.键入q退出安装程序。

And done.并做了。 These steps fixed git add -i for me.这些步骤为我修复了git add -i

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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