Repository navigation
Fix configure failing to extract Pandoc under PowerShell 7.6.10 - #15390
Merged
Merged
Conversation
On Windows, configure extracted zips by running Expand-Archive in Windows PowerShell 5.1. When configure is launched from a PowerShell 7 terminal, the child inherits PSModulePath with PowerShell 7's module directory first, so 5.1 loads PowerShell 7's Microsoft.PowerShell.Archive. Version 1.2.7 of that module (bundled with PowerShell 7.6.10) calls a .NET Core-only ExtractToDirectory overload, which throws on .NET Framework while the process still exits 0. Nothing was extracted, the error was never printed, and configure later failed renaming pandoc.exe with "NotFound (os error 3)". The build-time unzip now delegates to the runtime helper in src/core/zip.ts, which calls [IO.Compression.ZipFile]::ExtractToDirectory directly and loads no module (it moved off Expand-Archive in 2023), and throws with the archive path and stderr when extraction fails. The runtime helper runs unzip with the destination as cwd on Linux/macOS, so the destination is created first. update-pandoc downloaded the pandoc source archive without a .zip extension, which the runtime helper would treat as a tarball; it now uses pandoc.zip.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
configure.cmdruns from a PowerShell 7.6.10 terminal on Windows, it stops at "Configuring Pandoc" withNotFound (os error 3)while renamingpandoc.exe. The Pandoc zip downloads correctly, but nothing is extracted from it.Root cause
The build-time
unzip()inpackage/src/util/utils.tsextracted zips by runningExpand-Archivein Windows PowerShell 5.1. The child process inheritsPSModulePathfrom the PowerShell 7 terminal, with PowerShell 7's module folder listed first, so Windows PowerShell 5.1 loads PowerShell 7'sMicrosoft.PowerShell.Archivemodule instead of its own.PowerShell 7.6.10 bundles version 1.2.7 of that module (PowerShell/PowerShell#28410), whose
Expand-Archivecalls anExtractToDirectoryoverload that only exists on .NET Core. Under Windows PowerShell 5.1 the call throws, but the process still exits 0, so configure never showed the error and failed later on the missing file.Quarto users are not affected. The runtime extraction helper in
src/core/zip.tsstopped usingExpand-Archivein 33a51a0 and calls[IO.Compression.ZipFile]::ExtractToDirectorydirectly, which loads no module.Fix
The build-time
unzip()now delegates to the runtime helper insrc/core/zip.ts, and throws with the archive path and the error output when extraction fails. This covers every build step that extracts a zip: the Pandoc and Deno binaries, the Pandoc source templates, and the WiX tools for the Windows installer.Two adjustments come with the delegation. On Linux and macOS the runtime helper runs
unzip -ofrom inside the destination folder, so the folder is now created first.update-pandocsaved the Pandoc source archive without a.zipextension, which the runtime helper would treat as a tarball, so it is now saved aspandoc.zip.Test plan
CI runners may not have PowerShell 7.6.10, so these were checked locally on Windows with PowerShell 7.6.10:
configure.cmdfrom a PowerShell 7 terminal extracts Pandoc and completesChecklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.