Skip to content

Invoke the System32 tar.exe in bootstrap.ps1 Rather Than Whatever tar PATH Resolves - #2474

Merged
ptr727 merged 4 commits into
developfrom
fix/bootstrap-system32-tar
Oct 7, 2026
Merged

ptr727 merged 4 commits into
developfrom
fix/bootstrap-system32-tar

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

host-setup/bootstrap.ps1 ran & tar and checked Get-Command tar, so the tar it reached depended on the PATH of the shell that launched it. A pwsh started from Git Bash finds MSYS /usr/bin/tar first, which reads the C: prefix of the archive path as a remote host, and the extraction fails.

  • Get-TarPath names %SystemRoot%\System32\tar.exe, and both the extraction and the prerequisite check now use it.
  • test_bootstrap_ps1_names_the_system32_tar pins the System32 path and refuses tar in command position in any non-comment line: bare, &-invoked, quoted, .exe-suffixed, or under Get-Command [-Name].

Part of #2471, which the promotion pull request closes.

Verification

Native, on Windows 11, launched from Git Bash with /usr/bin/tar first on PATH, pwsh -NoProfile -File host-setup/bootstrap.ps1 -Report -Dir <scratch dir>:

  • Before (develop at c9b2c66): tar (child): Cannot connect to C: resolve failed, then ERROR: Could not extract the downloaded archive, exit 1.
  • After (this branch): the tree extracted and the report ran to ==> Done, exit 0.

-Report drives the same Get-Tree extraction that -Skills does, without rewriting this host's installed Skills.

  • test_bootstrap_ps1_names_the_system32_tar passes, and it fails against a copy with the bare tar -xzf restored.
  • PSScriptAnalyzer on bootstrap.ps1 reports 0 findings. ruff check and format are clean.
  • local-strict-review: round 1 raised one finding, that the test regex missed a bare tar statement, fixed in bc052f8. Round 2 found nothing.
  • Six TestSpecCoverage.test_linux_installer_* tests error with WinError 193 on Windows, the same on clean develop. They are filed as Skip the Linux Installer Tests in test_bootstrap Where install-tools.sh Cannot Execute #2473.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 7, 2026 07:07
… PATH Resolves

A pwsh launched from Git Bash finds MSYS tar first on PATH, and that tar reads
the drive prefix of the Windows archive path as a remote host, so extraction
failed. The loader now names %SystemRoot%\System32\tar.exe at both the
extraction and the prerequisite check, and a test pins that no bare tar
remains.

Closes #2471

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 7, 2026 14:10
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 03b43c48-1443-4899-94c2-097818252cc3
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.47%. Comparing base (c9b2c66) to head (023259b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2474   +/-   ##
========================================
  Coverage    58.47%   58.47%           
========================================
  Files           16       16           
  Lines         8062     8062           
========================================
  Hits          4714     4714           
  Misses        3348     3348           
Flag Coverage Δ
python-3.13 58.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Extend the regression guard to cover all valid Get-Command option orders.

Review effort: Lite
Findings: None

What changed in this PR

Updates Windows bootstrap extraction to use System32 tar.exe instead of PATH-resolved tar.

Changes:

  • Adds a shared System32 tar path helper.
  • Uses it for extraction and prerequisite checks.
  • Adds regression coverage for PATH-based tar resolution.
File Description
tests/​test_bootstrap.py Verifies tar is not resolved through PATH.
host-setup/​bootstrap.ps1 Uses the explicit System32 tar path.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

Copilot overview note ("Extend the regression guard to cover all valid Get-Command option orders"): real, fixed in da4f6a2, then widened in 023259b. The fix covers the class rather than the instance. Any non-comment line in which Get-Command, gcm, Start-Process, start or saps names a standalone tar or tar.exe token fails, whatever the option order. A bare tar in command position after ^ ; | { ( & = , also fails. A probe covered 17 bypass spellings, including Get-Command -ErrorAction SilentlyContinue tar, Get-Command -CommandType Application tar, $v = tar --version and Get-Command pwsh, tar. The guard caught all of them and matches no line of the real bootstrap.ps1. A mutant with the reordered Get-Command restored fails the test. Indirect forms (Invoke-Expression, a call through a variable, [Diagnostics.Process]::Start) are out of reach for a line regex, and this file uses none of them. Each fix commit went through local-strict-review, and the last pass at 023259b found nothing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues remain.

Review effort: Lite
Findings: None

@ptr727
ptr727 merged commit f9a6573 into develop Oct 7, 2026
13 checks passed
@ptr727
ptr727 deleted the fix/bootstrap-system32-tar branch October 7, 2026 14:22
ptr727 added a commit that referenced this pull request Oct 7, 2026
… Rather Than Whatever tar PATH Resolves (#2475)

## Summary

Promotes [#2474](#2474) to
`main`. `host-setup/bootstrap.ps1` extracted its archive with whatever
`tar` `PATH` resolved. A pwsh launched from Git Bash finds MSYS
`/usr/bin/tar` first, which reads the `C:` prefix of the archive path as
a remote host, so `-Skills`, `-Report`, and every other mode that
fetches a tree failed with `Cannot connect to C: resolve failed`. The
loader now names `%SystemRoot%\System32\tar.exe` at both the extraction
and the prerequisite check. A test refuses `tar` in command position
anywhere in the file, including bare, `&`-invoked, quoted, and assigned
forms, and under `Get-Command`, `gcm`, `Start-Process` or their aliases
in any option order.

A native Windows 11 run, launched from Git Bash with `/usr/bin/tar`
first on `PATH`, failed on `develop` before the change and extracted and
ran to completion after it.

Closes #2471

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants