3

Trying to patch a file to last commit, so I run "git add -p" and "git add -i", but received the following error:

Output

That is:

D:\Working\test>git add-i
      0 [main] perl 375 child_copy: stack write copy failed, 6xFFFFC480..8x10000000e, done 6444523849, windows pid 15080, Win32 error 5
      [main] perl 375 child_copy: stack write copy failed, exFFFFC480..9x1000eeeee, done 6444523049, windows pid 15880, Win32 error 5
    481 [main) perl 375 dofork: child 376 - pid 13800, exitval ex183, errno 11 
     Can't fork, trying again in 5 seconds at C:/Program Files/Git/ming64/share/per15/Git.pm line 1647.
     main) perl 375 dofork: child 377 pid 4888, exitval ex103, errno 11 Can't fork, trying again in 5 seconds at C:/Program Files/Git/mingw64/share/per15/Git.pm line 1647.

D:\Working\test>git add -p
    0 [main] perl 9 child_copy: stack write copy failed, exFFFFC460..ex1eeeeeeee, done 6444523849, windows pid 7892, Min32 error S ses [main] perl 9 dofork: child 10 pid 11876, exitval ex183, errno 11
    Can't fork, trying again in 5 seconds at C:/Program Files/Git/mingw64/share/per15/Git.pm line 1647. 5033325 [main] perl 9 child 
     copy: stack write copy failed, exFFFFC460..9x100000000, done 6444523849, windows pid 7892, Win32 error 5 5033826 [main] perl 9 dofork: child 11 - pid 12220, exitval ex103, errno 11 Can't fork, trying again in 5 seconds at C:/Program Files/Git/ming 64/share/per15/it.pm line 1647.

Tried to uninstall and install Git, but the issue still persist.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 3
    `git add -i` and `git add -p` are Perl scripts; it looks like your Perl language interpreter is mis-installed or broken. – torek Oct 27 '21 at 05:35
  • 1
    Please share any relevant code by editing your Question - [instead of a screenshot](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question). Fewer people are likely to reproduce your issue without having your code in a copyable form. – tjheslin1 Oct 27 '21 at 05:44
  • Thanks to comment of @torek, I managed to use the commands after installing Perl. – Constantine Lee Oct 27 '21 at 05:58
  • @torek, Re "*it looks like your Perl language interpreter is mis-installed or broken.*" , That's not true. According to the error message, `perl` was successfully executing. It also indicates that the problem wasn't originating from Perl; the problem was originating from the OS emulation's `fork` emulation. – ikegami Oct 27 '21 at 16:56
  • @ikegami - Perl was partly running, but failing; on Windows, that usually means some sort of DLL issue, I believe. (As VonC noted in the answer, one can also just update to the current Git, in which some parts of this are now in C.) – torek Oct 27 '21 at 19:07
  • @torek, First of all, it wasn't failing on Windows, it was failing int he MSYS unix emulation. Windows doesn't even have a fork. // And while the rest may be true, it doesn't change what I said. The problem was in MSYS itself, not perl. The language of choice didn't matter. If a C program in MSYS were to use fork, it would have had exactly the same problem. So I repeat: the problem had nothing to do with Perl, contrary to what you said. – ikegami Oct 27 '21 at 19:19
  • And ... does not "msys emulation" count as "software that's run on Windows"? I wouldn't know all the ins and outs here, as I studiously *avoid* Windows, but to outsiders, everything that you run on a Windows system either *is* "Windows" or is "on Windows". Would you say that git.exe doesn't run "on Windows"? – torek Oct 27 '21 at 19:29

1 Answers1

5

Thanks to comment of @torek, I managed to use the commands after installing Per

You should not have.

  1. The latest versions of Git for Windows no longer use Perl for git add (mingw64/libexec/git-core/git-add.exe). This is rewritten in C since Git 2.25, Q1 2020.
  2. perl.exe is part of the Git for Windows distribution: make sure your %PATH% includes C:\path\to\Git\usr\bin

There is no need to install Perl for Git to run.


2 years later (Q1 2022), With Git 2.36 (Q2 2022), there are still finishing touches to C rewrite of "git add -i"(man) in single-key interactive mode.

See commit 0f584de, commit 6606d99, commit e4938ce, commit 02af15d (16 Mar 2022) by Phillip Wood (phillipwood).
See commit 32f3ac2 (09 Mar 2022) by Junio C Hamano (gitster).
(Merged by Junio C Hamano -- gitster -- in commit d723492, 30 Mar 2022)

terminal: restore settings on SIGTSTP

Signed-off-by: Phillip Wood

If the user suspends git while it is waiting for a keypress reset the terminal before stopping and restore the settings when git resumes.
If the user tries to resume in the background print an error message (taking care to use async safe functions) before stopping again.
Ideally we would reprint the prompt for the user when git resumes but this patch just restarts the read().

The signal handler is established with sigaction() rather than using sigchain_push() as this allows us to control the signal mask when the handler is invoked and ensure SA_RESTART is used to restart the read() when resuming.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250