Enable long file paths in Windows builds (#3711)

On Windows, jq could not open files whose paths exceed MAX_PATH (260
characters), even with LongPathsEnabled set, because the executable did
not declare longPathAware in its application manifest.

Embed an application manifest in jq.exe through a resource compiled
with windres, detected by configure for native Windows hosts. The
manifest keeps the asInvoker and supportedOS entries of the MinGW
default manifest it replaces and adds longPathAware. It uses a non-zero
resource language so that the linker drops the default manifest. Add a
PowerShell test that reads a file through a path longer than MAX_PATH
in the Windows CI jobs.

Co-authored-by: BaalEvan <baalevan@outlook.com>
This commit is contained in:
VoidsipandBaalEvan authored and GitHub committed 2026-12-06 09:48:56 +09:00
1 parent 19752f50a9
commit 22c22bcc30
6 files changed
+100 -1

No files matched your search

+5
View File
@@ -249,6 +249,11 @@ jobs:
run: |
make check VERBOSE=yes
git diff --exit-code
- name: Test long Windows paths
shell: pwsh
run: |
Set-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name LongPathsEnabled -Value 1
./tests/long-paths.ps1 -Jq ./jq.exe
- name: Upload Test Logs
if: ${{ failure() }}
uses: actions/upload-artifact@v7