Fix unTar resolving GNU tar on Windows when extracting .zip dependencies - #14812
Merged
Conversation
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 quarto-bld extracts a dependency archive on Windows and PATH puts Git's usr/bin ahead of System32 (a common Git for Windows layout),
unTarfails with a gzip "unexpected end of file" alongsidetar (child): Cannot connect to C: resolve failed.Root Cause
unTar/makeTarballinvoke baretarviaDeno.run, so resolution depends entirely on PATH. Windows ships bsdtar atSystem32\tar.exe, which reads ZIP archives, but GNU tar from a Git installation cannot read ZIP and additionally misparses a Windows absolute path (C:\...) as a remote-host spec. The compression flag also defaulted toz(gzip) for any extension other than.xz/.bz2, so.zipinputs were extracted withtar -xvzf— only working because bsdtar is lenient about format detection, and masking the real failure once GNU tar is picked up instead.configure.cmdalready solved the PATH half of this for the Deno bootstrap by calling%WINDIR%\System32\tar.exedirectly;quarto-bld's dependency extraction (Dart Sass, esbuild, Typst, deno_dom) never got the same treatment.Fix
Extracts the command-building logic in
package/src/util/tar.tsinto pure, unit-tested functions:windowsSystemTarbuilds the System32 path,resolveTarBinaryprefers it on Windows when present and falls back to PATHtarotherwise (matchingconfigure.cmd's existing precedent), andtarCompressFlagstops emitting a gzip flag for.zipinputs so bsdtar can detect the format itself.unTarandmakeTarballare wired through these helpers instead of hardcoding"tar".Adding the first test file that imports
tar.tssurfaced two pre-existingDeno.runtype errors underdeno test --check(Deno 2 removedDeno.runfrom its types but the runtime still implements it). Each call site now carries a@ts-expect-errorcomment, matching Deno's own documented migration guidance for this API rather than a shared type patch.Migrating these call sites to
Deno.Commandis left as separate, unrelated cleanup.