Skip to content

Fix Windows bootstrap command line limit and game version detection - #711

Merged
Zaldaryon merged 3 commits into
mainfrom
fix/windows-bootstrap-long-args-and-version-detect
Nov 20, 2026
Merged

Zaldaryon merged 3 commits into
mainfrom
fix/windows-bootstrap-long-args-and-version-detect

Conversation

@Zaldaryon

Copy link
Copy Markdown
Collaborator

Three user reports of the 0.4.1 Windows installer failing, all at scripts/bootstrap.ps1:610 with Program 'git.exe' failed to run: The filename or extension is too long, plus a report that the overlay rejects Vintage Story 1.22.7.

Command line too long. Test-PatchSyntaxBatch passed all 328 absolute patch paths to one git apply --stat. Windows rejects a command line over 32,766 characters. From C:\Users\<name>\AppData\Local\optimum\src-v0.4.1 that line is about 37,600 characters; CI never hit it because its checkout is D:\a\Optimum\Optimum (about 29,000). Any install root longer than 31 characters fails. Invoke-GitApplyOptimumPatchBatch has the same shape and would fail next. Both now split the paths with Split-GitPathArguments into chunks under 7,000 characters, which also fits a git.cmd shim.

Partial apply on conflict. git apply is atomic only inside one patch file. Given several, it applies them in order and stops at the first failure, so the earlier patches stay written and the per-patch fallback then reports them as failed. Each chunk is now checked with git apply --check before it is applied, so a chunk that fails writes nothing and falls back per patch on its own.

Game version. DetectGameVersion read the three-part file version 1.22.7 of VintagestoryLib.dll as 1.22, so the overlay version check rejected every manifest listing 1.22.7. The check shipped after 0.3.22. The normalization is now NormalizeGameVersion, with tests for 1.22.7, 1.22.7.0, 1.22.7.3, 1.22, a + suffix and non-versions.

Commits are split so the CI history shows the failure first. 5799a4b adds 400 long-named patches and a conflict case to bootstrap-patch-batching.ps1; on that commit alone, Windows PowerShell 5.1 and 7 batched patch apply fails with the same The filename or extension is too long error users reported (run 44803659671). The next two commits fix it.

Not covered: the StandardOutputEncoding is only supported when standard output is redirected message from one user. I could not reproduce it on Linux; it may come from the same call. Also not changed: bootstrap.sh has the same non-atomic assumption, but Linux and macOS argument limits are far above this patch count.

Tested locally: Optimum.Bootstrap.Core.Tests 290 passed, Optimum.Installer.Tests 106 passed, bootstrap-patch-batching.ps1 under PowerShell 7.7 on Linux. The Windows PowerShell 5.1 and 7 runs are in this PR's CI.

…s allows

Windows rejects a command line over 32,766 characters, and a full bootstrap
passes 300+ absolute patch paths to git apply from install roots such as
C:\Users\<name>\AppData\Local\optimum\src-v0.4.1. Add 400 long-named
patches to the batching test and check that a conflict inside one chunk does
not mark already-applied patches as failed.
…ine limit

Test-PatchSyntaxBatch and Invoke-GitApplyOptimumPatchBatch passed every patch
path to one git call. From an install root such as
C:\Users\<name>\AppData\Local\optimum\src-v0.4.1 that is over 37,000
characters, past the 32,766 CreateProcess limit, so the 0.4.1 Windows bootstrap
died with 'The filename or extension is too long'. Split the paths into chunks
under 7,000 characters, which also fits a git.cmd shim.

git apply is atomic only inside one patch file, so check each chunk before
applying it. A chunk that fails the check writes nothing and falls back per
patch without reporting already-applied patches as failures.
DetectGameVersion read a three-part file version such as 1.22.7 as 1.22, so
the overlay version check rejected every manifest listing 1.22.7. Move the
normalization into NormalizeGameVersion and cover the three-part, four-part
and suffixed forms.
@Zaldaryon
Zaldaryon marked this pull request as ready for review November 20, 2026 19:43
@Zaldaryon
Zaldaryon merged commit 4490cd1 into main Nov 20, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant