Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.16.1 (2) - Server 2008 - "error: cannot spawn sh: Function not implemented" #1475

Closed
laurinkeithdavis opened this issue Feb 3, 2018 · 34 comments
Assignees
Milestone

Comments

@laurinkeithdavis
Copy link

C:\xwiki\xwiki10\WEB-INF>git fetch
error: cannot spawn sh: Function not implemented
fatal: unable to fork

Verified the following:

  • Occurs on any "remote" commands (push, fetch), but not on "local" commands (status, commit).
  • Does not occur with Git version 2.16.1
  • Does not occur on Server 2012 R2 x74 or Windows 10 1709 Pro x64

Version:
git version 2.16.1.windows.2
cpu: x86_64
built from commit: e78e3c8
sizeof-long: 4

OS:
Server 2008 R2 Standard
Microsoft Windows [Version 6.1.7601]

Install Options:
Editor Option: VIM
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

@laurinkeithdavis laurinkeithdavis changed the title 2.16.1 (2) - Not working on Server 2008 - "error: cannot spawn sh: Function not implemented" 2.16.1 (2) - Server 2008 - "error: cannot spawn sh: Function not implemented" Feb 3, 2018
@let-none-survive
Copy link

Now working on Windwos 7 x64 error: cannot spawn git: Function not implemented

@dscho
Copy link
Member

dscho commented Feb 4, 2018

Does this happen with every spawned process, e.g. also the editor when committing? If so, I suspect that the new code to inherit only the standard handles is the culprit (I had come to believe that it is using API introduced in Vista...)

@Eli-Zaretskii
Copy link

Yes, also when invoking the editor. Here:

$ git commit -a
hint: Waiting for your editor to close the file... error: cannot spawn vi: Function not implemented
error: unable to start editor 'vi'
Please supply the message using either -m or -F option.

@laurinkeithdavis
Copy link
Author

The issues does not occur for me using commands like commit or status, only on commands that interact with remote repos, like fetch and push.

@Eli-Zaretskii
Copy link

"git status" works here as well. But "git commit" doesn't, and neither do pull, fetch, etc.

Let me know if you need me to test more commands.

@svseslav
Copy link

svseslav commented Feb 4, 2018

Git CMD (Windows7 x64):

git log -0
error: cannot spawn less: Function not implemented

git stash list
error: cannot spawn git-stash: Function not implemented

Git Bash does not have such problems. I downgraded git to v2.16.1.windows.1, and now it works as expected.

@glhez
Copy link

glhez commented Feb 4, 2018

I have the same problem with other commands:

  • git update (I think it was replaced by another but still... I don't expect a "error: cannot spawn git-update: Function not implemented")
  • git difftool -x lib/difftool.bash -y "$file" : this worked fine before now it produces. error: cannot spawn git: Function not implemented

The script (difftool.bash) is a simple wrapper to a sh file running some java program:

#!/bin/bash
source "lib/common.bash"
"${SHA1_EXEC}" diff --left "$1" --right "$2"

Also, I don't know if it is related - can't say for sure - the Windows shortcut "Git Bash" exit on start up (I assume there is some exit call [I don't have the time to view any error as the window close too fast for me to read anything]). I tried to remove anything in my ~/.bashrc but without effect. It worked with previous version (2.16.1.windows.1).

Running Gfw like this works: "C:\Program Files\Git\git-cmd.exe" --cd=E:\git --command=usr/bin/bash.exe -l -i
While the shortcut use "C:\Program Files\Git\git-bash.exe" --cd-to-home.

Info about my installation:

$ git --version --build-options
git version 2.16.1.windows.2
cpu: x86_64
built from commit: e78e3c8ee9c219723d60aa1bccd8348c2269b9ba
sizeof-long: 4
$ cmd.exe /c ver
Microsoft Windows [version 6.1.7601] <-- Windows 7 x64 French

@shiftkey
Copy link

shiftkey commented Feb 4, 2018

@dscho I can reproduce this on Windows 6.1.7601 in Git CMD (Git Bash seems unaffected).

While getting to the bottom of this issue, I'd recommend one of two workarounds for people who encounter this:

  • if you still want to use 2.16.1.windows.2, use Git Bash instead of Git CMD
  • if you can't live without Git CMD, install the previous version 2.16.1.windows.1

I'm also not aware if Git Bash has this issue. If you encounter a Function not implemented error while in Git Bash, please provide a detailed set of steps to reproduce the issue.

@dscho
Copy link
Member

dscho commented Feb 5, 2018

That's interesting... I specifically tested with Git CMD on Windows 10, and it seems to work.

@shiftkey any chance you can instrument the code in compat/mingw.c to see what GetLastError() reports after CreateProcessW() fails (which I assume fails)? I do not currently have any VM with winver 6.1.7601...

@shiftkey
Copy link

shiftkey commented Feb 5, 2018

That's interesting... I specifically tested with Git CMD on Windows 10, and it seems to work.

@dscho i think this is a combination of Win7/Server 2008 (different kernel?) and Git CMD, so Win10 not showing the issue does make sense.

I'll see if I can instrument things on Win7 and poke at the underlying error.

@shiftkey
Copy link

shiftkey commented Feb 5, 2018

screen shot 2018-02-05 at 3 36 24 pm

Installing the Git SDK gets stuck with not being able to hit a certain package URL on BinTray (I checked back to 1.0.3 and it had the same issue, and I get stuck in this loop when I don't have a proxy) - I can't dig into this without being able to access those 🤷‍♂️

@Eli-Zaretskii
Copy link

The problem I reported, with git pull and git fetch, happens in Git Bash. (I almost never invoke Git other than from the Git Bash window.) Here again are my installation options, as reported in my original report:

$ git --version --build-options
git version 2.16.1.windows.2
cpu: x86_64
built from commit: e78e3c8
sizeof-long: 4

$ cat /etc/install-options.txt
Editor Option: VIM
Path Option: BashOnly
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

Maybe the triage which concluded my problem and this one is the same issue was wrong? Or maybe the fact that I don't use MinTTY (see above) is a factor? But otherwise, my problem definitely happens when invoking Git from Git Bash.

Let me know how can I add more useful information.

@Geobert
Copy link

Geobert commented Feb 5, 2018

git clone is affected as well.

@dscho
Copy link
Member

dscho commented Feb 5, 2018

Installing the Git SDK gets stuck with not being able to hit a certain package URL on BinTray (I checked back to 1.0.3 and it had the same issue, and I get stuck in this loop when I don't have a proxy) - I can't dig into this without being able to access those 🤷‍♂️

@shiftkey Hrmph.

Yes, BinTray failed us. It is "rate limiting" Git for Windows. For some definition of "rate limiting". What it does in reality is to deny any service until their support gets in touch with me, which they claim might take a while because my free plan does not include any support option.

So we're kinda stuck right now, between a rock and a hard place.

@VictorVG
Copy link

VictorVG commented Feb 5, 2018

Also Win7 SP1 can't work on to simple script:

@echo off
if exist git_old.log copy /y /b git_old.log + /b git.log /b git_old.log > nul
if not exist git_old.log  (if exist git.log ren git.log git_old.log)
echo %DATE%%TIME% > git.log
echo. >> git.log
echo NetBox: >> git.log
echo. >> git.log
cd Far-NetBox&&git pull origin -f >> ..\git.log&&cd ..\
echo. >> git.log
echo FarColorer: >> git.log
echo. >> git.log
cd FarColorer&&git pull origin -f >> ..\git.log&&cd  ..\
echo. >> git.log
echo luacheck: >> git.log
echo. >> git.log
cd luacheck&&git pull origin -f >> ..\git.log&&cd ..\
echo. >> git.log
echo plugsrc Cpp: >> git.log
echo. >> git.log
cd plugsrc\src\cpp&&git pull origin -f >> ..\..\..\git.log&&cd ..\
echo. >> ..\..\git.log
echo evil-programmers: >> ..\..\git.log
echo. >> ..\..\git.log
cd evil-programmers&&git pull origin -f >> ..\..\..\git.log&&cd ..\
echo. >> ..\..\git.log
echo FarPlugins MaximuS: >> ..\..\git.log
echo. >> ..\..\git.log
cd FarPlugins-MaximuS&&git pull origin -f >> ..\..\..\git.log&&cd ..\..\..\
echo. >> git.log
echo Process Hacker Src: >> git.log
echo. >> git.log
cd ProcessHacker\src&&git pull origin -f >> ..\..\git.log
echo. >> ..\..\git.log
echo Process Hacker Src plugins-extra: >>  ..\..\git.log
echo. >> ..\..\git.log
cd plugins-extra&&git pull origin -f >> ..\..\..\git.log&&cd ..\..\
echo. >> ..\git.log
echo Process Hacker Trunk: >> ..\git.log
echo. >> ..\git.log
cd trunk&&git pull origin -f >> ..\..\git.log
echo. >> ..\..\git.log
echo Process Hacker Trunk plugins-extra: >> ..\..\git.log
echo. >> ..\..\git.log
cd plugins-extra&&git pull origin -f >> ..\..\..\git.log&&cd ..\..\..\
echo. >>git.log
echo Rufus: >> git.log
echo. >> git.log
cd rufus&&git pull origin -f >> ..\git.log&&cd ..\
echo. >> git.log
echo SumatraPDF: >> git.log
echo. >> git.log
cd SumatraPDF\source&&git pull origin -f >> ..\..\git.log&&cd ..\..\
echo. >> git.log
echo YMSPlugins: >> git.log
echo. >> git.log
cd YMSPlugins&&git pull origin -f >> ..\git.log&cd ..\
echo. >> git.log
echo ====================================================== >> git.log
echo. >> git.log
setlocal
call :size git.log
if (%retn%) == (675) del /q/f git.log > nul
exit
:size
set retn=%~z1
goto:EOF
  • write to console:

$ Git-2.16.1.2-64-bit.exe

$ git_check.cmd
error: cannot spawn git: Function not implemented
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.
Системе не удается найти указанный путь.

but v2.16.1.0 work success. I downgarade v2.16.1(2) up to 2.16.1.0 ....

@dscho
Copy link
Member

dscho commented Feb 5, 2018

Bash Terminal Option: ConHost

@Eli-Zaretskii for practical purposes, you are using cmd.exe by using that choice.

@dscho dscho added this to the v2.16.1(3) milestone Feb 5, 2018
@dscho dscho self-assigned this Feb 5, 2018
@Eli-Zaretskii
Copy link

for practical purposes, you are using cmd.exe by using that choice.

Ah, okay, thanks for clarifying.

@dscho dscho added git and removed git-upstream labels Feb 5, 2018
@erw7
Copy link

erw7 commented Feb 5, 2018

@dscho After CreateProcessW() failed, I confirmed that GetLastError () will return 1450(ERROR_NO_SYSTEM_RESOURCES).
I found the following information.

@dscho
Copy link
Member

dscho commented Feb 5, 2018

@erw7 I spent all day today trying to figure this one out. Apparently, certain handles are inherited implicitly, and it has something to do with cmd.exe.

I found, for example, that restricting the list of handles to inherit to 0 handles worked. The CreateProcessW() call succeeded on 2008 R2, and the spawned git-remote-https.exe process was still able to write to stderr and it was still able to communicate with the parent git.exe process, even if those three standard handles were not explicitly marked as inheritable (but we pretended that we wanted none of the handles to be inherited).

I will still be trying to figure this one out until I understand every aspect of it, but I am tempted to simply disable the feature. Earlier today, I thought about simply disabling it based on the Windows version, but now I am thinking more about trying to detect this very error condition and just call CreateProcessW() again, without extended startup info.

Yes, it would exacerbate the locking issues we tried to fix, but honestly, a software that does not work is worse than a software that is really safe only on the newest Operating System.

@dscho dscho closed this as completed in dc364ab Feb 5, 2018
@ulyanovvladimir
Copy link

not working on windows 7 32bit.:
git clone results:
error: cannot spawn git: Function not implemented

@dscho
Copy link
Member

dscho commented Feb 6, 2018

@ulyanovvladimir are you trying to tell me that you tested with a Git for Windows that includes dc374ab? Because if you did test with such a version, I would be very interested in a lot more details.

dscho added a commit to git-for-windows/build-extra that referenced this issue Feb 6, 2018
On Windows 7 and older, Git for Windows v2.16.1(2) was no longer able
to spawn any processes (e.g. during fetch/clone). This regression
[has been fixed](git-for-windows/git#1475).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@linquize
Copy link

linquize commented Feb 7, 2018

1.16.1(2), 1.16.1(3) do not work.
git pull in TortoiseGit

@ghost
Copy link

ghost commented Feb 7, 2018

I can confirm that 1.16.1(3) still has issues
git stash in TortoiseGit (latest Beta 2.5.7)
error: cannot spawn git-stash: Invalid argument

@shiftkey
Copy link

shiftkey commented Feb 7, 2018

@linquize @0x084E please open a fresh issue with full repro steps, so we can confirm whether it's the same problem or a different one

@ghost
Copy link

ghost commented Feb 7, 2018

I think it was already done, sorry for not looking before
#1481

@VictorVG
Copy link

VictorVG commented Feb 7, 2018

Thanks! I also test and Git dc364ab is working success.

@dscho
Copy link
Member

dscho commented Feb 7, 2018

1.16.1(2), 1.16.1(3) do not work.

Surely you mean 2.16.1(2) and 2.16.1(3) ;-)

But yes, I think #1481 is the ticket to discuss this, and I would love to get to the bottom of this as soon as possible. Every bit of help is greatly appreciated!

@hemant2491
Copy link

hemant2491 commented Apr 12, 2019

Got the similar issue in Windows 10 , running bash terminal on Mobaxterm
` ➤ git pull
warning: failed to restrict file handles (216)

handle #0: 00000000000001d4 (type 3, handle info (1) 0
handle #1: 00000000000001d8 (type 3, handle info (1) 1
handle #2: 00000000000001f0 (type 3, handle info (1) 1

This is a bug; please report it at
https://github.com/git-for-windows/git/issues/new

To suppress this warning, please set the environment variable

    SUPPRESS_HANDLE_INHERITANCE_WARNING=1

error: cannot spawn ssh: Function not implemented
fatal: unable to fork

──────────────────────────────────────────────────`

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
➤ git --version --build-options
git version 2.16.2.windows.1
cpu: x86_64
built from commit: e1848984d1004040ec5199e749b5f282ddf4bb09
sizeof-long: 4
                                   
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
    windown 10
➤ cmd.exe /c ver

Microsoft Windows [Version 10.0.16299.1029]

  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

➤ cat "C:\Program Files\Git\etc\install-options.txt"
Editor Option: VIM
Path Option: BashOnly
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

** mobaxterm terminal **

➤ echo $SHELL
/bin/bash.exe
** git pull **
➤ git pull
warning: failed to restrict file handles (216)

handle #0: 0000000000000198 (type 3, handle info (1) 0
handle #1: 000000000000019c (type 3, handle info (1) 1
handle #2: 00000000000001f0 (type 3, handle info (1) 1

This is a bug; please report it at
https://github.com/git-for-windows/git/issues/new

To suppress this warning, please set the environment variable

        SUPPRESS_HANDLE_INHERITANCE_WARNING=1

error: cannot spawn ssh: Function not implemented
fatal: unable to fork

  • What did you expect to occur after running these commands?

** pull latest repo changes **

  • What actually happened instead?

** error: cannot spawn ssh: Function not implemented
fatal: unable to fork **

@dscho
Copy link
Member

dscho commented Apr 12, 2019

git version 2.16.2.windows.1

Please upgrade, the problem will be magically gone, then.

@ashokmagadum
Copy link

Issue persists in git version 2.36.0.windows.1

$git --version --build-options
git version 2.36.0.windows.1
cpu: x86_64
built from commit: ea1e13f
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon

OS Details:

Edition : Windows 10 Enterprise
Version : 21H2
Os Build : 19044.1706
Experince : Windows Feature Experience Pack 120.2212.4170.0

@dscho
Copy link
Member

dscho commented May 20, 2022

@ashokmagadum are you sure you get the exact same error? I am talking about this:

warning: failed to restrict file handles (216)

216 corresponds to ERROR_EXE_MACHINE_TYPE_MISMATCH...

@ashokmagadum
Copy link

ashokmagadum commented May 22, 2022

I receive ["error: cannot spawn sh: Function not implemented"]

@dscho
Copy link
Member

dscho commented May 22, 2022

I receive ["error: cannot spawn sh: Function not implemented"]

That's very different from the original report, which mentions ssh, not sh.

@rimrul
Copy link
Member

rimrul commented May 23, 2022

I receive ["error: cannot spawn sh: Function not implemented"]

That's very different from the original report, which mentions ssh, not sh.

This comment mentions SSH, but the original issue mentions SH

#1475 (comment)

C:\xwiki\xwiki10\WEB-INF>git fetch
error: cannot spawn sh: Function not implemented
fatal: unable to fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests