Skip to content

Upgrade aborts in InitializeSetup since 2.56.0 when git version of the existing installation produces no output #6554

Open

Description

@notbucki

Existing issues matching what you're seeing

  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows version

2.56.1 (installer), upgrading from 2.55.0.5. The 2.56.0, 2.56.0.2, 2.56.0.3 and 2.56.0.4 installers behave the same.

Windows version

Windows 11

Windows CPU architecture

x86_64 (64-bit)

Additional Windows version information

10.0.26300

Options set during installation

Defaults (previous installation: ext, ext\shellhere, ext\guihere, gitlfs, assoc, assoc_sh, scalar)

Other interesting things

This is a regression in the installer's robustness that came with the switch to ExecAndCaptureOutput (bc59ce3 in git-for-windows/build-extra, first shipped in 2.56.0).

GetPreviousGitVersion() runs <InstallPath>\cmd\git.exe version and reads the first captured line without checking that there is one:

PreviousGitVersion:=Trim(Output.StdOut[0]);

The previous ExecWithCapture-based code used Trim(StdOut) on a string, so an empty output simply left the previous version unknown and the upgrade continued. Since InitializeSetup calls GetPreviousGitVersion() on every upgrade, setup now aborts with an opaque Pascal Script runtime error whenever git.exe version exits with 0 but prints nothing. Fresh installs are not affected, because without InstallPath the call is skipped.

How this can happen in practice: some endpoint management tools temporarily register an Image File Execution Options Debugger for git.exe during software updates, to keep users from starting Git. We hit this with Patch My PC (we have since changed that configuration on our side). The installer's own call is then redirected to the tool's stub, which exits with 0 without output. The 2.55.0.x installers upgraded fine under exactly the same conditions.

Suggested fix:

        if (RegQueryStringValue(HKEY_LOCAL_MACHINE,'Software\GitForWindows','InstallPath',Path))
                and (ExecAndCaptureOutput(Path+'\cmd\git.exe', 'version', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ExitCode, Output))
                and (ExitCode=0) and (GetArrayLength(Output.StdOut)>0) then begin
            PreviousGitVersion:=Trim(Output.StdOut[0]);

Logging a warning when the call succeeds but returns no output would also make this much easier to diagnose. It took us quite a while to get from Runtime error (at 158:581) to the cause. It may also be worth checking the other ExecAndCaptureOutput call sites for the same assumption.

Terminal/shell

PowerShell

Commands that trigger the issue

# 1. Install a previous version machine-wide, e.g. Git-2.55.0.5-64-bit.exe
# 2. Make git.exe exit with 0 without output (stub via IFEO)
New-Item C:\temp -ItemType Directory -Force | Out-Null
$ifeo = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\git.exe'
New-Item $ifeo -Force | Out-Null
Set-ItemProperty $ifeo -Name Debugger -Value 'C:\Windows\System32\cmd.exe /c echo blocked>>C:\temp\ifeo-hit.txt'
# 3. Run the new installer and wait for it to finish
Start-Process .\Git-2.56.1-64-bit.exe -ArgumentList '/VERYSILENT /NORESTART /SP- /SUPPRESSMSGBOXES /LOG=C:\temp\git-setup.log' -Wait
# 4. Clean up
Remove-Item $ifeo -Recurse -Force
# Afterwards C:\temp\ifeo-hit.txt contains: blocked "C:\Program Files\Git\cmd\git.exe" version
# On the same machine, the same upgrade without the IFEO entry succeeds.

Expected behaviour

The upgrade continues, as with the 2.55.0.x installers: an empty output of git version is treated like a failed call.

Actual behaviour

Setup (Inno Setup 7.1.0, 64-bit) exits with code 1. Log excerpt:

2026-11-12 11:01:34.308   InitializeSetup raised an exception (fatal).
2026-11-12 11:01:34.308   Exception message:
2026-11-12 11:01:34.308   Defaulting to OK for suppressed message box (OK):
                          Runtime error (at 158:581):

                          Array index out of bounds (0). Length is 0.
2026-11-12 11:01:34.309   Deinitializing Setup.

Repository

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions