fix(install.ps1): skip MSYS /proc symlinks when extracting pinned git
The Git-for-Windows archive ships dev/fd, dev/std{in,out,err} and
etc/mtab as symlinks into /proc. Without symlink rights (a standard
user, not elevated, no Developer Mode) inbox bsdtar cannot create them
and exits non-zero, so the bootstrap failed with "failed to extract
pinned git archive" before pm existed.
Exclude exactly the links pm's own extractor skips (extract_tar
git_msys); any other extraction failure, e.g. a truncated archive,
still fails. A test pins the installer's list to pm's skip set.
Install E2E never saw this: GitHub-hosted Windows runners run as an
elevated administrator, which holds SeCreateSymbolicLinkPrivilege.
This commit is contained in:
@@ -541,7 +541,14 @@ function Get-PinnedGit {
|
||||
# System32; a GNU tar earlier on PATH (Cygwin/MSYS) reads C:\ as a
|
||||
# remote host, so never resolve it from PATH.
|
||||
$inboxTar = Join-Path $env:SystemRoot 'System32\tar.exe'
|
||||
Invoke-Native { & $inboxTar -xf $tarPath -C $extractDir }
|
||||
# MSYS ships these as symlinks into /proc. Without symlink rights (not
|
||||
# elevated, no Developer Mode) tar cannot create them and fails the
|
||||
# whole extract. Skip exactly the links pm's own extractor skips
|
||||
# (pm/store.py extract_tar git_msys) so any other failure still fails.
|
||||
# '^' anchors bsdtar's otherwise any-path-component match.
|
||||
$msysProcLinks = @('dev/fd', 'dev/stdin', 'dev/stdout', 'dev/stderr', 'etc/mtab')
|
||||
$excludes = foreach ($link in $msysProcLinks) { '--exclude'; "^$link" }
|
||||
Invoke-Native { & $inboxTar @excludes -xf $tarPath -C $extractDir }
|
||||
if ($LASTEXITCODE) { Fail "failed to extract pinned git archive" }
|
||||
# Layout: Git-<ver>/cmd\git.exe — flatten the single wrapper dir.
|
||||
$inner = @(Get-ChildItem $extractDir)
|
||||
|
||||
Reference in New Issue
Block a user