Skip to content

Promote develop to main: Invoke the System32 tar.exe in bootstrap.ps1 Rather Than Whatever tar PATH Resolves - #2475

Merged
ptr727 merged 2 commits into
mainfrom
develop
Oct 7, 2026
Merged

ptr727 merged 2 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

Promotes #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

… PATH Resolves (#2474)

## 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 #2473.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 7, 2026 14:22
@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: 0b766dfa-9c3c-4c2e-acd6-4582baf2f003
  • 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.

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 reject path-qualified tar executables.

Review effort: Lite
Findings: None

What changed in this PR

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

Changes:

  • Uses the explicit System32 executable for extraction and prerequisite checks.
  • Adds regression coverage against PATH-based tar invocation.
File Summary
tests/​test_bootstrap.py Adds tar resolution safeguards; path-qualified executables remain uncovered.
host-setup/​bootstrap.ps1 Uses the explicit System32 tar executable.

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

@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 (e96cb58).
⚠️ Report is 320 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2475   +/-   ##
=======================================
  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.

@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

Copilot overview note ("Extend the regression guard to reject path-qualified tar executables"): real. A path to Git's own tar.exe would reach MSYS tar without PATH. This is the third variant raised against an enumerated deny-list, so the guard is being replaced with an allow-list rather than given another pattern. Outside a .tar.gz archive name, the only non-comment lines that may name tar are the Get-TarPath definition and its die message. A mutation probe shows it catches a bare tar, & tar, the Git path, & /usr/bin/tar, a reordered Get-Command, $t='tar'; & $t and Start-Process tar.exe, while the unchanged file passes. The fix lands through its own feature -> develop pull request, linked here once it opens, and reaches this promotion when it merges.

## Summary

Answers the Copilot overview note on promotion
[#2475](#2475), "Extend
the regression guard to reject path-qualified tar executables". A path
to Git's own `tar.exe` reaches the same MSYS tar without going through
`PATH`.

`test_bootstrap_ps1_names_the_system32_tar` used to enumerate the forms
that resolve tar through `PATH`, and each review round found another. It
is now an allow-list. Outside a `.tar.gz` archive name, the only
non-comment lines in `bootstrap.ps1` that may name tar are the exact
`Get-TarPath` definition and its whole-line `die '...'` message. Any
other line naming tar fails, whatever form its invocation takes.

Part of #2471.

## Verification

- A mutation probe replaced the extraction line with each of these, and
the test failed for every one:
  - a bare `tar`
  - `& tar`
  - `& "$env:ProgramFiles\Git\usr\bin\tar.exe"`
  - `& /usr/bin/tar`
  - a reordered `Get-Command -ErrorAction SilentlyContinue tar`
  - `$t = 'tar'; & $t`
  - `Start-Process -FilePath tar.exe`
  - `die 'x'; tar ...`
- The unchanged file passes.
- A line check cannot reach a computed name such as `('t' + 'ar')`, and
the docstring says so by scoping its claim to lines that name tar.
- ruff check and format are clean.
- `local-strict-review`: round 1 raised one finding, a docstring that
overclaimed, fixed in 9c83788. Round 2 found nothing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

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.

🟢 Approval recommended

Only a non-blocking documentation nit remains.

0 open findings

🧠 Review effort: Lite

@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

Copilot overview on e96cb58 ("Only a non-blocking documentation nit remains", 0 open findings): no nit is named in the overview or in any thread, so there is nothing specific to act on. The earlier note on f9a6573 ("Extend the regression guard to reject path-qualified tar executables") was fixed by #2476, merged into develop as e96cb58, which replaces the deny-list with an allow-list. The comments on #2476 record its probe evidence.

@ptr727
ptr727 merged commit 32b0ae3 into main Oct 7, 2026
13 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.

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

2 participants